[yum-cvs] cli.py docs/yum.8

Jeremy Katz katzj at linux.duke.edu
Thu Aug 9 15:09:14 UTC 2007


 cli.py     |   12 ++++++++++--
 docs/yum.8 |    7 +++++++
 2 files changed, 17 insertions(+), 2 deletions(-)

New commits:
commit b9dab7066c2cf265790a58a083f32976a3850b5a
Author: Jeremy Katz <katzj at redhat.com>
Date:   Thu Aug 9 11:06:29 2007 -0400

    add support for --quiet and --verbose on the command-line

diff --git a/cli.py b/cli.py
index fd63ad0..ac2e660 100644
--- a/cli.py
+++ b/cli.py
@@ -136,6 +136,11 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
 
         # get the install root to use
         root = self.optparser.getRoot(opts)
+
+        if opts.quiet:
+            opts.debuglevel = 0
+        if opts.verbose:
+            opts.debuglevel = opts.errorlevel = 6
        
         # Read up configuration options and initialise plugins
         try:
@@ -1115,12 +1120,11 @@ class YumOptionParser(OptionParser):
         self.logger.critical("Command line error: %s", msg)
         sys.exit(1)
 
-        
     def firstParse(self,args):
         # Parse only command line options that affect basic yum setup
         try:
             args = _filtercmdline(
-                        ('--noplugins','--version'), 
+                        ('--noplugins','--version','-q', '-v', "--quiet", "--verbose"), 
                         ('-c', '-d', '-e', '--installroot','--disableplugin'), 
                         args)
         except ValueError:
@@ -1238,6 +1242,10 @@ class YumOptionParser(OptionParser):
         self.add_option("-e", dest="errorlevel", default=None,
                 help="error output level", type='int',
                 metavar=' [error level]')
+        self.add_option("-q", "--quiet", dest="quiet", action="store_true",
+                        help="quiet operation")
+        self.add_option("-v", "--verbose", dest="verbose", action="store_true",
+                        help="verbose operation")
         self.add_option("-y", dest="assumeyes", action="store_true",
                 help="answer yes for all questions")
         self.add_option("--version", action="store_true", 
diff --git a/docs/yum.8 b/docs/yum.8
index ff7141f..f329a83 100644
--- a/docs/yum.8
+++ b/docs/yum.8
@@ -161,6 +161,13 @@ Configuration Option: \fBassume\-yes\fP
 .IP "\fB\-c [config file]\fP" 
 Specifies the config file location - can take http, ftp urls and local file
 paths\&.
+.br
+.IP "\fB\-q, \-\-quiet\fP" 
+Run without output.  Note that you likely also want to use \-y\&.
+.br
+.IP "\fB\-v, \-\-verbose\fP" 
+Run with a lot of debugging output\&.
+.br
 .IP "\fB\-d [number]\fP" 
 Sets the debugging level to [number] \- turns up or down the amount of things that are printed\&. Practical range: 0 - 10
 .br



More information about the Yum-cvs-commits mailing list