aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/ui/command_line.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-28 10:56:04 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-28 10:56:04 -0500
commite2b648f2148d7b6550fb3a4bcfde4eff714a7ec6 (patch)
tree0d4e90ed1ce25f2d22a9f08a19ead6af614ef785 /libbe/ui/command_line.py
parent4fbf5d1d222610b0775f95472fe1a60aaedea29f (diff)
downloadbugseverywhere-e2b648f2148d7b6550fb3a4bcfde4eff714a7ec6.tar.gz
Allow external use of Command.usage() and use CmdOptionParser.set_usage()
This fixes $ python be diff -2 Usage: be [options] be: error: no such option: -2 and we now get the correct output $ python be diff -2 Usage: be diff [options] [REVISION] be: error: no such option: -2
Diffstat (limited to 'libbe/ui/command_line.py')
-rwxr-xr-xlibbe/ui/command_line.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/libbe/ui/command_line.py b/libbe/ui/command_line.py
index 856f810..b5a3991 100755
--- a/libbe/ui/command_line.py
+++ b/libbe/ui/command_line.py
@@ -48,6 +48,8 @@ class CmdOptionParser(optparse.OptionParser):
self._option_by_name = {}
for option in self.command.options:
self._add_option(option)
+ self.set_usage(command.usage())
+
def _add_option(self, option):
option.validate()
@@ -215,7 +217,7 @@ class BE (libbe.command.Command):
name='args', optional=True, repeatable=True)
])
- def _usage(self):
+ def usage(self):
return 'usage: be [options] [COMMAND [command-options] [COMMAND-ARGS ...]]'
def _long_help(self):