]> git.michaelhowe.org Git - packages/b/bup.git/commitdiff
options.py: make --usage just print the usage message.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 20 Feb 2011 05:34:51 +0000 (21:34 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 20 Feb 2011 05:38:28 +0000 (21:38 -0800)
This is a relatively common option in other programs, so let's make it work
in case someone tries to use it.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
lib/bup/options.py

index ec0f6ed6713280a7d57dba692cff2d877bc6ad23..9be71110622e8aa92e57aed67bbe69fc2fedae93 100644 (file)
@@ -115,7 +115,7 @@ class Options:
         self.optfunc = optfunc
         self._aliases = {}
         self._shortopts = 'h?'
-        self._longopts = ['help']
+        self._longopts = ['help', 'usage']
         self._hasparms = {}
         self._defaults = {}
         self._usagestr = self._gen_usage()
@@ -214,7 +214,7 @@ class Options:
 
         for (k,v) in flags:
             k = k.lstrip('-')
-            if k in ('h', '?', 'help'):
+            if k in ('h', '?', 'help', 'usage'):
                 self.usage()
             if k.startswith('no-'):
                 k = self._aliases[k[3:]]