summaryrefslogtreecommitdiff
path: root/examples/argparse_example.py
Commit message (Collapse)AuthorAgeFilesLines
* Added warning to documentation about how help_foo won't be called for ↵Todd Leonhardt2018-10-061-113/+0
| | | | | | | command foo if it uses an argparse decorator Also: - Renamed argparse_example.py to decorator_example.py
* Standardize cmd2 imports in tests and exampleskotfu2018-05-231-5/+5
|
* Merge branch 'test_merge' into test_ply_mergeEric Lin2018-05-021-1/+1
|\
| * Removed the expensive imports from cmd2/__init__.pyEric Lin2018-04-251-1/+1
| | | | | | | | | | | | | | Added some shared definitions to cmd2/__init__.py -> maybe there's a better place for these? Figured out how to trick bash into showing argument hints. It's a bit weird. Updated all of the tests and examples to import cmd2 resources from their new location without the automatic imports in cmd2/__init__.py For #369
* | multilineCommands -> multiline_commandskotfu2018-04-291-1/+1
|/
* Started removing dependency on sixTodd Leonhardt2018-04-151-1/+1
| | | | | | | Removed all dependency on six other than for six.moves.input Also: - Started removing code branches which were for Python 2 support
* Deleted optparse code which had been previously deprecated in 0.8.0 releaseTodd Leonhardt2018-04-091-26/+1
| | | | | Also: - Bumped version to 0.8.4
* Renamed @with_argument_parser decorator to @with_argparserTodd Leonhardt2018-01-211-3/+3
| | | | | Also: - Reanamed foo and bar subcommand methods to base_foo and base_bar
* Simplified a few argparse examples and fixed some incorrect documentationTodd Leonhardt2018-01-171-2/+2
| | | | | | I eliminated a few "narg=1" configurations so that a single str value is returned instead of a List[str]. I also reworded some documentation which was no longer correct after the last commit which made "history command" have the same help text as "command -h" when using one of the two argparse decorators.
* Improved how new argparse-based decorators provide helpTodd Leonhardt2018-01-171-1/+1
| | | | | | Now "help command_name" and "command_name -h" provide exactly the same text. The function docstring for the "do_*" command sets and overrides the ArgumentParser "description" if the docstring is not empty.
* Changed @with_argument_parser to only pass single argument to commandsTodd Leonhardt2018-01-151-2/+2
| | | | Also added another @with_argparser_and_list decorator that uses argparse.parse_known_args to pass two arguments to a command: both the argparse output and a list of unknown/unmatched args.
* Made a couple cleanup changesTodd Leonhardt2018-01-151-11/+13
| | | | | | | | | 1) cmd2 no longer imports make_option from optparse - test files and examples now import this directly - this helps emphasize that this old optparse methodology of adding options to commands is deprecated 2) All argparsers have been given custom names instead of just "argparser" - this helps with readability and maintainability, especially with IDE renaming and such
* new @with_argument_list decoratorkotfu2018-01-121-5/+15
|
* @with_argument_parser now passes an arglist instead of a stringkotfu2018-01-121-2/+2
|
* simplify outputJared Crapo2018-01-101-6/+3
|
* Clean up variable nameskotfu2018-01-071-2/+2
|
* Set prog in argparser based on the name of the functionkotfu2018-01-071-4/+1
|
* Properly set docstring so it contains help messagekotfu2018-01-071-36/+36
|
* Add tests for POSIX=true and arguments containing spaceskotfu2018-01-071-2/+18
|
* Default posix and quote removal working.kotfu2018-01-071-15/+17
|
* Merge branch 'master' of https://github.com/python-cmd2/cmd2 into argparseJared Crapo2017-12-111-8/+8
|\
| * Made a couple fixes to existing examplesTodd Leonhardt2017-11-111-8/+8
| | | | | | | | | | | | | | Changes include: - argparse_example.py modified to do pass all unknown args onto cmd2 and allow arguments at invocation - example.py comments modified to indicate it is intended to be used with transcript_regext.txt - exampleSession.txt fixed so it works properly with argparse_example.py
* | Plan and first working code for argparse decoratorJared Crapo2017-12-111-1/+25
|/
* Fixed a few bugs and examplesTodd Leonhardt2017-07-031-9/+11
| | | | | | | | | | | | | | Bug fixes: - case_insensitive is no longer a runtime-settable parameter, but it was still listed as such - Fixed a recursive loop bug when abbreviated commands are enabled and it could get stuck in the editor forever - Added additional command abbreviations to the "exclude from history" list - Fixed argparse_example.py and pirate.py examples Other changes: - Organized all attributes used to configure the ParserManager into a single location - Set the default value of "abbrev" to False (which controls whether or not abbreviated commands are allowed) - With good tab-completion of command names, using abbreviated commands isn't a particularly useful feature - And it can create problems
* Mostly fix a bunch of spelling mistakes.Todd Leonhardt2017-03-131-3/+3
| | | | A few other miscellaneous minor tweaks for whitespace and such.
* Added info to CHANGES.rst on what bugs have been fixed so far this release.Todd Leonhardt2017-03-041-0/+88
Fixed a bug where the allow_cli_args attribute wasn't properly preventing OptParse from prasing the args looking for "-t" or "--test" for transcript testing. Added an example of using Argparse with cmd2.