diff options
author | W. Trevor King <wking@drexel.edu> | 2008-12-02 11:12:56 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-12-02 11:12:56 -0500 |
commit | 5fa64ba20ad15124d36386c816ea93ab56f83f39 (patch) | |
tree | 33c8440a3ad9afe745c92f8fca12c100c690074e /becommands | |
parent | 6b8eb93cd6b35840b7186c02225c75091a603b64 (diff) | |
download | bugseverywhere-5fa64ba20ad15124d36386c816ea93ab56f83f39.tar.gz |
Added auto-completion for becommands/set property names.
Diffstat (limited to 'becommands')
-rw-r--r-- | becommands/set.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/becommands/set.py b/becommands/set.py index 1103b7b..b8a125e 100644 --- a/becommands/set.py +++ b/becommands/set.py @@ -44,7 +44,7 @@ def execute(args, test=False): """ parser = get_parser() options, args = parser.parse_args(args) - cmdutil.default_complete(options, args, parser) + complete(options, args, parser) if len(args) > 2: raise cmdutil.UsageError, "Too many arguments" bd = bugdir.BugDir(from_disk=True, manipulate_encodings=not test) @@ -95,3 +95,15 @@ To unset a setting, set it to "none". 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": + # no argument-options at the moment, so this is future-proofing + raise cmdutil.GetCompletions() + for pos,value in enumerate(args): + if value == "--complete": + if pos == 0: # first positional argument is a setting name + props = bugdir.BugDir.settings_properties + raise cmdutil.GetCompletions(props) + raise cmdutil.GetCompletions() # no positional arguments for list |