summaryrefslogtreecommitdiff
path: root/examples/subcommands.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix unit tests and exampleTodd Leonhardt2018-03-161-2/+5
| | | | | | functools.partialmethod() was added in Python 3.4, so it can't be used in Python 2.7. - Modified the code to skip trying to use it for Python 2.7 - Skip the two unit tests which test its usage on Python 2.7
* Added unit tests and examples for tab completion of subcommandsKevin Van Brunt2018-03-161-7/+27
|
* No longer need to manually specify subcommand names for tab completionKevin Van Brunt2018-03-141-4/+1
|
* Fixed typoKevin Van Brunt2018-03-011-1/+1
|
* Renamed @with_argument_parser decorator to @with_argparserTodd Leonhardt2018-01-211-6/+6
| | | | | Also: - Reanamed foo and bar subcommand methods to base_foo and base_bar
* Added unit tests for sub-commandsTodd Leonhardt2018-01-201-2/+2
|
* Tab-completion of subcommand names is now supportedTodd Leonhardt2018-01-201-1/+4
|
* Just improved a few comments in the subcommands.py exampleTodd Leonhardt2018-01-201-3/+3
|
* Added support for argparse sub-commands when using cmd2 decoratorsTodd Leonhardt2018-01-201-0/+58
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.