public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: /, roverlay/
Date: Thu,  5 Jul 2012 16:00:11 +0000 (UTC)	[thread overview]
Message-ID: <1341503415.51c037ec3f153398db7f2e10c3c5961d328617b1.dywi@gentoo> (raw)

commit:     51c037ec3f153398db7f2e10c3c5961d328617b1
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Jul  5 15:50:15 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Jul  5 15:50:15 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=51c037ec

main script: --print-config

	modified:   main.py
	modified:   roverlay/argutil.py

---
 main.py             |   24 ++++++++++++++++++------
 roverlay/argutil.py |   12 +++++++++++-
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/main.py b/main.py
index a4f2227..df76b32 100755
--- a/main.py
+++ b/main.py
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import os
 import sys
 
 # roverlay modules will be imported later
@@ -7,11 +8,11 @@ import sys
 HIDE_EXCEPTIONS = False
 
 class DIE ( object ):
-	NOP          =   0
-	ERR          =   1
-	BAD_USAGE    =   3
-	ARG          =   9
-	CONFIG       =  10
+	NOP          =  os.EX_OK
+	ERR          =  1
+	BAD_USAGE    =  os.EX_USAGE
+	ARG          =  9
+	CONFIG       =  os.EX_CONFIG
 	OV_CREATE    =  20
 	SYNC         =  30
 	CMD_LEFTOVER =  90
@@ -74,7 +75,10 @@ except ImportError:
 		raise
 
 try:
-	roverlay.load_config_file ( config_file, extraconf=additional_config )
+	conf = roverlay.load_config_file (
+		config_file,
+		extraconf=additional_config
+	)
 	del config_file, additional_config
 except:
 	if HIDE_EXCEPTIONS:
@@ -82,6 +86,14 @@ except:
 	else:
 		raise
 
+if OPTION ( 'print_config' ):
+	try:
+		conf.visualize ( into=sys.stdout )
+	except:
+		die ( "Cannot print config!" )
+	sys.exit ( os.EX_OK )
+
+
 # -- determine commands to run
 # (TODO) could replace this section when adding more actions
 

diff --git a/roverlay/argutil.py b/roverlay/argutil.py
index 8e37694..540743a 100644
--- a/roverlay/argutil.py
+++ b/roverlay/argutil.py
@@ -151,12 +151,21 @@ def get_parser ( CMD_DESC, DEFAULT_CONFIG ):
 		**opt_in
 	)
 
+	arg (
+		'--print-config', '--pc',
+		help="print config and exit",
+		**opt_in
+	)
+
+	# --write-desc
+	# --log-level, --log-console, --log...
+
 	# TODO
 	arg (
 		'--debug',
 		help='''
 			Turn on debugging. This produces a lot of messages.
-			(TODO: always on).
+			(TODO: has no effect).
 		''',
 		**opt_in
 	)
@@ -200,6 +209,7 @@ def parse_argv ( *args, **kw ):
 		show_overlay   = p.show_overlay,
 		write_overlay  = p.write_overlay,
 		print_stats    = p.stats,
+		print_config   = p.print_config,
 		force_distroot = p.force_distroot,
 	)
 



             reply	other threads:[~2012-07-05 16:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-05 16:00 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-07-06 22:19 [gentoo-commits] proj/R_overlay:master commit in: /, roverlay/ André Erdmann
2012-07-30 15:53 André Erdmann
2012-08-02 15:14 André Erdmann
2012-08-20 14:04 André Erdmann
2013-01-09 19:15 André Erdmann
2013-01-28 23:54 André Erdmann
2013-02-05 17:48 André Erdmann
2013-02-09 20:45 André Erdmann
2013-04-25 16:44 André Erdmann
2013-07-11 17:11 André Erdmann
2013-08-09 10:18 André Erdmann
2013-08-19 15:42 André Erdmann
2013-09-23 15:30 André Erdmann
2014-07-29 20:26 André Erdmann
2014-08-23 19:03 ` André Erdmann
2014-08-23 19:03 André Erdmann
2024-08-23  7:28 Benda XU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341503415.51c037ec3f153398db7f2e10c3c5961d328617b1.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox