diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-20 11:54:43 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-20 11:54:43 -0500 |
commit | 136de7e22fa04ed41fc37b8a6c900cf507db8f26 (patch) | |
tree | 4f4f4662a6075398b2a7d2de9db7083406d3506a /tests/test_transcript.py | |
parent | 7b564b4424accfbd7439de10a169d9b64bc599c5 (diff) | |
download | cmd2-git-136de7e22fa04ed41fc37b8a6c900cf507db8f26.tar.gz |
Added support for argparse sub-commands when using cmd2 decorators
Modified the do_help() method to behave differently for methods which have been decorated with an argparse ArgumentParser.
This is so that help will properly deal with sub-command help.
Suppose you have a base command "base" which has two sub-commands, "foo" and "bar". Then "help base" will provide very different help text than "help base foo".
Slightly tweaked the two argparse decorators to set an attribute in the decorated function's dictionary so that the do_help method can know which functions have an ArgumentParser and which do not.
Added a "subcommands.py" example for demonstrating how to create and use subcommands based on argparse and the cmd2 @with_argument_parser decorator.
Diffstat (limited to 'tests/test_transcript.py')
0 files changed, 0 insertions, 0 deletions