diff options
author | Eric Lin <anselor@gmail.com> | 2018-04-23 15:19:54 -0400 |
---|---|---|
committer | Eric Lin <anselor@gmail.com> | 2018-04-23 15:19:54 -0400 |
commit | 25d52d7301064278d4159dbb967ffd2f7d9fd21c (patch) | |
tree | 84b7f3db681aca1c357d56be4f169887823747c9 /cmd2/cmd2.py | |
parent | cbb94bff0cfed8c0ccbf8e0c2dd4c61f59881573 (diff) | |
download | cmd2-git-25d52d7301064278d4159dbb967ffd2f7d9fd21c.tar.gz |
Added support for using cmd2 application class methods as an argument completion provider. The default completion implementation in Cmd2 automatically passes self to AutoCompleter to be passed to the class method.
Diffstat (limited to 'cmd2/cmd2.py')
-rwxr-xr-x | cmd2/cmd2.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 288a506b..820e9441 100755 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -1838,7 +1838,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) + completer = AutoCompleter(argparser, cmd2_app=self) tokens, _ = self.tokens_for_completion(line, begidx, endidx) results = completer.complete_command(tokens, text, line, begidx, endidx) |