diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-20 15:48:54 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-20 15:48:54 -0500 |
commit | 29ef26875664dfa3d70273b321092a83a68d9966 (patch) | |
tree | 8effdf53ec9675d8ba50db6a284a64efba0718ce /examples/subcommands.py | |
parent | 86d81c37f78cc1990d466876d9aeb8594be79e85 (diff) | |
download | cmd2-git-29ef26875664dfa3d70273b321092a83a68d9966.tar.gz |
Tab-completion of subcommand names is now supported
Diffstat (limited to 'examples/subcommands.py')
-rwxr-xr-x | examples/subcommands.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/subcommands.py b/examples/subcommands.py index 7cab74dd..eaadbb64 100755 --- a/examples/subcommands.py +++ b/examples/subcommands.py @@ -42,7 +42,10 @@ class SubcommandsExample(cmd2.Cmd): parser_bar.add_argument('z', help='string') parser_bar.set_defaults(func=bar) - @with_argument_parser(base_parser) + # Create a list of subcommand names, which is used to enable tab-completion of sub-commands + subcommands = ['foo', 'bar'] + + @with_argument_parser(base_parser, subcommands) def do_base(self, args): """Base command help""" try: |