From 6cf5535bf35791a6349fac2c04299b59c5659ea0 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 14 Mar 2011 10:52:17 -0700 Subject: [PATCH] emerge: support [ y | n ] for --quiet This allows --quiet and --quiet-build to be enabled via EMERGE_DEFAULT_OPTS, and then temporarily disabled via the command- line. --- man/emerge.1 | 6 +++--- pym/_emerge/help.py | 7 +++++-- pym/_emerge/main.py | 29 ++++++++++++++++++++++++++--- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/man/emerge.1 b/man/emerge.1 index 9aae64d73..1cf12bdc4 100644 --- a/man/emerge.1 +++ b/man/emerge.1 @@ -1,4 +1,4 @@ -.TH "EMERGE" "1" "Feb 2011" "Portage VERSION" "Portage" +.TH "EMERGE" "1" "Mar 2011" "Portage VERSION" "Portage" .SH "NAME" emerge \- Command\-line interface to the Portage system .SH "SYNOPSIS" @@ -504,11 +504,11 @@ B blocked by another package (unresolved conflict) b blocked by another package (automatically resolved conflict) .TE .TP -.BR "\-\-quiet " (\fB\-q\fR) +.BR "\-\-quiet [ y | n ] (\-q short option)" Results may vary, but the general outcome is a reduced or condensed output from portage's displays. .TP -.BR \-\-quiet\-build +.BR "\-\-quiet\-build [ y | n ]" Redirect all build output to logs alone, and do not display it on stdout. .TP diff --git a/pym/_emerge/help.py b/pym/_emerge/help.py index 2f8b342cd..020bc4206 100644 --- a/pym/_emerge/help.py +++ b/pym/_emerge/help.py @@ -578,11 +578,14 @@ def help(myopts, havecolor=1): print(" printed out accompanied by a '+' for enabled and a '-' for") print(" disabled USE flags.") print() - print(" "+green("--quiet")+" ("+green("-q")+" short option)") + print(" " + green("--quiet") + \ + " [ %s | %s ] (%s short option)" % \ + (turquoise("y"), turquoise("n"), green("-q"))) print(" Effects vary, but the general outcome is a reduced or condensed") print(" output from portage's displays.") print() - print(" "+green("--quiet-build")) + print(" " + green("--quiet-build") + \ + " [ %s | %s ]" % (turquoise("y"), turquoise("n"))) desc = "Redirect all build output to logs alone, and do not " + \ "display it on stdout." for line in wrap(desc, desc_width): diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py index ce643cd26..33fe03459 100644 --- a/pym/_emerge/main.py +++ b/pym/_emerge/main.py @@ -65,8 +65,6 @@ options=[ "--nodeps", "--noreplace", "--nospinner", "--oneshot", "--onlydeps", "--pretend", -"--quiet", -"--quiet-build", "--quiet-unmerge-warn", "--resume", "--searchdesc", @@ -91,7 +89,6 @@ shortmapping={ "n":"--noreplace", "N":"--newuse", "o":"--onlydeps", "O":"--nodeps", "p":"--pretend", "P":"--prune", -"q":"--quiet", "r":"--resume", "s":"--search", "S":"--searchdesc", "t":"--tree", @@ -437,6 +434,8 @@ def insert_optional_args(args): '--jobs' : valid_integers, '--keep-going' : y_or_n, '--package-moves' : y_or_n, + '--quiet' : y_or_n, + '--quiet-build' : y_or_n, '--rebuilt-binaries' : y_or_n, '--root-deps' : ('rdeps',), '--select' : y_or_n, @@ -462,6 +461,7 @@ def insert_optional_args(args): 'G' : y_or_n, 'k' : y_or_n, 'K' : y_or_n, + 'q' : y_or_n, } arg_stack = args[:] @@ -697,6 +697,19 @@ def parse_opts(tmpcmdline, silent=False): "choices" : true_y_or_n }, + "--quiet": { + "shortopt" : "-q", + "help" : "reduced or condensed output", + "type" : "choice", + "choices" : true_y_or_n + }, + + "--quiet-build": { + "help" : "redirect build output to logs", + "type" : "choice", + "choices" : true_y_or_n + }, + "--rebuilt-binaries": { "help" : "replace installed packages with binary " + \ "packages that have been rebuilt", @@ -869,6 +882,16 @@ def parse_opts(tmpcmdline, silent=False): if myoptions.package_moves in true_y: myoptions.package_moves = True + if myoptions.quiet in true_y: + myoptions.quiet = True + else: + myoptions.quiet = None + + if myoptions.quiet_build in true_y: + myoptions.quiet_build = True + else: + myoptions.quiet_build = None + if myoptions.rebuilt_binaries in true_y: myoptions.rebuilt_binaries = True -- 2.26.2