aboutsummaryrefslogtreecommitdiffstats
path: root/libbe
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-07-06 15:54:13 -0400
committerW. Trevor King <wking@drexel.edu>2009-07-06 15:54:13 -0400
commitab1b33b702c4c84a90fd5d7ba8c6dd0078fc303a (patch)
tree37d05931973c5e52247dc6df5625664495505e33 /libbe
parenta536332660c8374e2000541e2db5ad6cea3b0e5e (diff)
downloadbugseverywhere-ab1b33b702c4c84a90fd5d7ba8c6dd0078fc303a.tar.gz
Added ability to show individual comments with "be show".
Diffstat (limited to 'libbe')
-rw-r--r--libbe/cmdutil.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/libbe/cmdutil.py b/libbe/cmdutil.py
index edc6442..0dd8ad0 100644
--- a/libbe/cmdutil.py
+++ b/libbe/cmdutil.py
@@ -141,7 +141,7 @@ def option_value_pairs(options, parser):
def default_complete(options, args, parser, bugid_args={}):
"""
- A dud complete implementation for becommands to that the
+ A dud complete implementation for becommands so that the
--complete argument doesn't cause any problems. Use this
until you've set up a command-specific complete function.
@@ -149,15 +149,25 @@ def default_complete(options, args, parser, bugid_args={}):
arguments taking bug shortnames and the values are functions for
filtering, since that's a common enough operation.
e.g. for "be open [options] BUGID"
- bugid_args = {0: lambda bug : bug.active == False}
+ bugid_args = {0: lambda bug : bug.active == False}
+ A positional argument of -1 specifies all remaining arguments
+ (e.g in the case of "be show BUGID BUGID ...").
"""
for option,value in option_value_pairs(options, parser):
if value == "--complete":
raise cmdutil.GetCompletions()
+ if len(bugid_args.keys()) > 0:
+ max_pos_arg = max(bugid_args.keys())
+ else:
+ max_pos_arg = -1
for pos,value in enumerate(args):
if value == "--complete":
+ filter = None
if pos in bugid_args:
filter = bugid_args[pos]
+ if pos > max_pos_arg and -1 in bugid_args:
+ filter = bugid_args[-1]
+ if filter != None:
bugshortnames = []
try:
bd = bugdir.BugDir(from_disk=True,