aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2008-11-27 09:34:54 -0500
committerW. Trevor King <wking@drexel.edu>2008-11-27 09:34:54 -0500
commit8e989347bdefab6a77e32072265fa0bd8c143c43 (patch)
treefc1d47e6b7bfef9c7d8e3517d8e9fbf7026ed8c6 /libbe
parentadb7e854b56aa7c3df6fae677fe383f417e364c4 (diff)
downloadbugseverywhere-8e989347bdefab6a77e32072265fa0bd8c143c43.tar.gz
Merged --commands and --options into --complete. Simpler that way.
Diffstat (limited to 'libbe')
-rw-r--r--libbe/cmdutil.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py
index aad6bbe..2bfe6d4 100644
--- a/libbe/cmdutil.py
+++ b/libbe/cmdutil.py
@@ -86,16 +86,12 @@ def help(cmd=None):
ret.append("be %s%*s %s" % (name, numExtraSpaces, "", desc))
return "\n".join(ret)
-def options(cmd=None):
- if cmd != None:
- parser = get_command(cmd).get_parser()
- longopts = []
- for opt in parser.option_list:
- longopts.append(opt.get_opt_string())
- return longopts
- else:
- # These probably shouldn't be hardcoded...
- return ["--help","--commands","--options"]
+def options(cmd):
+ parser = get_command(cmd).get_parser()
+ longopts = []
+ for opt in parser.option_list:
+ longopts.append(opt.get_opt_string())
+ return longopts
def raise_get_help(option, opt, value, parser):
raise GetHelp
@@ -109,9 +105,9 @@ class CmdOptionParser(optparse.OptionParser):
self.remove_option("-h")
self.add_option("-h", "--help", action="callback",
callback=raise_get_help, help="Print a help message")
- self.add_option("--options", action="callback",
+ self.add_option("--complete", action="callback",
callback=raise_get_completions,
- help="Print a list of available long options")
+ help="Print a list of available completions")
def error(self, message):
raise UsageError(message)