aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/ui/command_line.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-12-29 19:00:40 -0500
committerW. Trevor King <wking@drexel.edu>2009-12-29 19:00:40 -0500
commit4372a17b4215df25b3da0b68daf4d6b490a8955c (patch)
tree4464d284fe0653701e43b3dc5a465dd14da056b3 /libbe/ui/command_line.py
parentd0fdc606a0420807cfbde0519d1807bd16f14c37 (diff)
downloadbugseverywhere-4372a17b4215df25b3da0b68daf4d6b490a8955c.tar.gz
Fixed up the completion helpers in libbe.command.util
This entailed a fairly thorough cleanup of libbe.util.id. Remaining unimplemented completion helpers: * complete_assigned() * complete_extra_strings() Since these would require scanning all (active?) bugs to compile lists, and I was feeling lazy...
Diffstat (limited to 'libbe/ui/command_line.py')
-rwxr-xr-xlibbe/ui/command_line.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/libbe/ui/command_line.py b/libbe/ui/command_line.py
index b5a3991..b99f812 100755
--- a/libbe/ui/command_line.py
+++ b/libbe/ui/command_line.py
@@ -113,15 +113,19 @@ class CmdOptionParser(optparse.OptionParser):
self.complete(argument, fragment)
for i,arg in enumerate(parsed_args):
if arg == '--complete':
- if i < len(self.command.args):
+ if i > 0 and self.command.name == 'be':
+ break # let this pass through for the command parser to handle
+ elif i < len(self.command.args):
argument = self.command.args[i]
+ elif len(self.command.args) == 0:
+ break # command doesn't take arguments
else:
argument = self.command.args[-1]
if argument.repeatable == False:
raise libbe.command.UserError('Too many arguments')
fragment = None
- if i < len(args) - 1:
- fragment = args[i+1]
+ if i < len(parsed_args) - 1:
+ fragment = parsed_args[i+1]
self.complete(argument, fragment)
if len(parsed_args) > len(self.command.args) \
and self.command.args[-1].repeatable == False:
@@ -149,7 +153,8 @@ class CmdOptionParser(optparse.OptionParser):
comps = self.command.complete(argument, fragment)
if fragment != None:
comps = [c for c in comps if c.startswith(fragment)]
- print '\n'.join(comps)
+ if len(comps) > 0:
+ print '\n'.join(comps)
raise CallbackExit