diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-02-23 13:38:56 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-02-23 13:38:56 -0500 |
commit | 9726e982d6c81619e9355db2d495e9dd1a01578d (patch) | |
tree | db91a3ba71bbb483c1dac16d7859cb76ce7ba582 /cmd2/cmd2.py | |
parent | 7b1b8b10e35b57a813369c9b23876d3615213026 (diff) | |
download | cmd2-git-9726e982d6c81619e9355db2d495e9dd1a01578d.tar.gz |
Made cmd2_app a positional and required argument of AutoCompleter.
Deleted bash tab completion support.
AutoCompleter no longer assumes CompletionItem results are sorted.
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 03fc719e..1f981417 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1574,7 +1574,7 @@ class Cmd(cmd.Cmd): def _autocomplete_default(self, text: str, line: str, begidx: int, endidx: int, argparser: argparse.ArgumentParser) -> List[str]: """Default completion function for argparse commands.""" - completer = AutoCompleter(argparser, cmd2_app=self) + completer = AutoCompleter(argparser, self) tokens, _ = self.tokens_for_completion(line, begidx, endidx) if not tokens: @@ -2564,7 +2564,7 @@ class Cmd(cmd.Cmd): # Check if this is a command with an argparse function func = self.cmd_func(command) if func and hasattr(func, 'argparser'): - completer = AutoCompleter(getattr(func, 'argparser'), cmd2_app=self) + completer = AutoCompleter(getattr(func, 'argparser'), self) matches = completer.complete_command_help(tokens[cmd_index:], text, line, begidx, endidx) return matches @@ -2593,7 +2593,7 @@ class Cmd(cmd.Cmd): # Getting help for a specific command func = self.cmd_func(args.command) if func and hasattr(func, 'argparser'): - completer = AutoCompleter(getattr(func, 'argparser'), cmd2_app=self) + completer = AutoCompleter(getattr(func, 'argparser'), self) tokens = [args.command] + args.subcommand self.poutput(completer.format_help(tokens)) else: |