diff options
author | W. Trevor King <wking@drexel.edu> | 2008-11-27 10:16:18 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-11-27 10:16:18 -0500 |
commit | 216e39db0bd3491ee3740f69a8f2afd49f76eb2f (patch) | |
tree | 5fc519ba693a4819f725de6e5b4d3de6fea1deb8 /becommands/list.py | |
parent | 8e989347bdefab6a77e32072265fa0bd8c143c43 (diff) | |
download | bugseverywhere-216e39db0bd3491ee3740f69a8f2afd49f76eb2f.tar.gz |
Command completion simplified and working for list, dummies for other cmds.
All the other commands currently use default_complete(), which has no
effect other than catching the --complete option and effectively
aborting execution.
This closes 8e1bbda4-35b6-4579-849d-117b1596ee99
Diffstat (limited to 'becommands/list.py')
-rw-r--r-- | becommands/list.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/becommands/list.py b/becommands/list.py index 25e72d3..ff340e3 100644 --- a/becommands/list.py +++ b/becommands/list.py @@ -34,16 +34,7 @@ def execute(args, test=False): """ parser = get_parser() options, args = parser.parse_args(args) - - for option in [o.dest for o in parser.option_list if o.dest != None]: - value = getattr(options, option) - if value == "--complete": - if option == "status": - raise cmdutil.GetCompletions(status_values) - raise cmdutil.GetCompletions() - if "--complete" in args: - raise cmdutil.GetCompletions() # no completions for arguments yet - + complete(options, args, parser) if len(args) > 0: raise cmdutil.UsageError("Too many arguments.") @@ -203,3 +194,14 @@ The boolean options are ignored if the matching string option is used. def help(): return get_parser().help_str() + longhelp + +def complete(options, args, parser): + for option, value in cmdutil.option_value_pairs(options, parser): + if value == "--complete": + if option == "status": + raise cmdutil.GetCompletions(status_values) + elif option == "severity": + raise cmdutil.GetCompletions(severity_values) + raise cmdutil.GetCompletions() + if "--complete" in args: + raise cmdutil.GetCompletions() # no positional arguments for list |