[yum-git] cli.py

James Antill james at linux.duke.edu
Wed Apr 2 14:54:32 UTC 2008


 cli.py |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit bb596fb4115689e089f6aa76efa5064de819b53d
Author: James Antill <james at and.org>
Date:   Wed Apr 2 10:24:59 2008 -0400

    Add optparse like explanation, so "yum -c" errors like "yum -R"

diff --git a/cli.py b/cli.py
index 231fd42..741fcc7 100644
--- a/cli.py
+++ b/cli.py
@@ -978,8 +978,10 @@ class YumOptionParser(OptionParser):
                         ('--noplugins','--version','-q', '-v', "--quiet", "--verbose"), 
                         ('-c', '-d', '-e', '--installroot','--disableplugin'), 
                         args)
-        except ValueError:
+        except ValueError, arg:
             self.base.usage()
+            print >> sys.stderr, (_("\n\n%s: %s option requires an argument") %
+                                  ('Command line error', arg))
             sys.exit(1)
         return self.parse_args(args=args)[0]
 
@@ -1180,10 +1182,10 @@ def _filtercmdline(novalopts, valopts, args):
 
         elif a in valopts:
             if len(args) < 1:
-                raise ValueError
+                raise ValueError, a
             next = args.pop(0)
             if next[0] == '-':
-                raise ValueError
+                raise ValueError, a
 
             out.extend([a, next])
        



More information about the Yum-cvs-commits mailing list