summaryrefslogtreecommitdiff
path: root/cmd2.py
Commit message (Collapse)AuthorAgeFilesLines
* Removed support for case-insensitive command parsingTodd Leonhardt2018-03-021-24/+11
|
* Removed abbrev attributeKevin Van Brunt2018-03-021-13/+3
|
* Fixed slicing bugKevin Van Brunt2018-03-021-17/+31
|
* Fixed some parsing bugs and added more unit testsKevin Van Brunt2018-03-021-10/+16
|
* Sorting all completion results. Added unit tests for help command.Kevin Van Brunt2018-03-021-10/+16
|
* Added tab completing subcommands to help commandKevin Van Brunt2018-03-021-0/+32
|
* Corrected tab completion of subcommands.Kevin Van Brunt2018-03-021-58/+55
|
* Fixed check to add spaceKevin Van Brunt2018-03-011-1/+1
|
* Restoring execute permission on cmd2.py for ease of exploratory testingTodd Leonhardt2018-03-011-0/+0
|
* A bit of refactoring to tab completion. Shortcuts not beginning with symbols ↵Kevin Van Brunt2018-03-011-37/+65
| | | | now tab complete.
* Added flag and index based tab completionKevin Van Brunt2018-03-011-123/+233
| | | | | Moved path_complete out of the Cmd class Rewrote shell_complete
* Merge branch 'master' into unused_and_edit_fixesTodd Leonhardt2018-02-271-2/+10
|\
| * Revert to old attribute names for multilineCommands and excludeFromHistory ↵Todd Leonhardt2018-02-271-7/+6
| | | | | | | | | | | | | | to prevent breaking change Also: - Reverted multilineCommands and shortcuts to class variables to prevent other breaking changes
| * Merge branch 'master' into instance_variablesTodd Leonhardt2018-02-271-0/+5
| |\
| | * Added use of @functools.wraps() in our decorators.Todd Leonhardt2018-02-231-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | This updates a wrapper function to look like the wrapped function. This partially addresses Issue #271 where using multiple decorators can break help on subcommands, depending on the order in which the decorators are applied. This PR doesn't actually fix anything in and of itself. But it encourages the usage of @functools.wraps(). If other decorators use this, then there shouldn't be any problem. Of course, we can't control how 3rd-party libraries implement decorators. But we can at least be part of the solution instead of part of the problem.
| * | Converted a few class variables into instance variablesTodd Leonhardt2018-02-231-7/+11
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that users can nest instances of cmd.Cmd2 to support creating sub-menus, we should need to be more careful about class vs instance variables to prevent potential problems. This converts the following former class variables into instance variables: - multiline_commands - shortcuts - exclude_from_help - exclude_from_history In the process, a couple camelCase variable names got converted to pep8_compliant names. There may be a few other class variables which should be converted to instance variables. But at the very least, this is a good start. This closes #273.
* | Fixed removed_unused.py example and help for edit commandTodd Leonhardt2018-02-241-1/+1
|/ | | | | | | | | The remove_unused.py example had become outdated since the cmdenvironment command no longer exists. The help text for the edit command was outdated since the functionality for editing previous commands got moved from the edit command to the history command. This closes #276. This closes #282.
* Check if name is in self.names before removingBrandon Squizzato2018-02-121-1/+2
|
* Added optional persistent readline history featureTodd Leonhardt2018-02-081-5/+23
| | | | | | | | | | | | - Including an example and info in the Sphinx docs Also: - Created CHANGELOG entry for 0.8.1 release - Added info to README about new sub-menu feature - Bumped version to 0.8.1 TODO: - Added a unit test for the persistent readline history feature
* When calling a submenu command from a higher level, strip off the first ↵Calvin Lobo2018-02-041-2/+3
| | | | | | argument (which enters the submenu) and pass the rest on to the submenu
* Changed arg name in _complete_from_cmd() so it doesn't shadow name from ↵Calvin Lobo2018-02-041-15/+15
| | | | | | | outer scope. Changed default arg for shared_attributes to None instead of a dict (bad because mutable) Changed arg name in __call__() so it doesn't shadow name from outer scope.
* Merge branch 'master' into feature/submenuTodd Leonhardt2018-02-031-237/+404
|\
| * Improved argument processing docsTodd Leonhardt2018-02-011-1/+1
| | | | | | | | | | | | | | | | Improved the documentation related to how to use the argparse decorators. Also: - Fixed a comment in cmd2.py which referred to the old decorator before the rename - Fixed README.md which had the old decorator name in it prior to the rename
| * Fixed issue with automated transcript generation via "history -t"Todd Leonhardt2018-01-291-0/+7
| | | | | | | | There is now a post-processing step which escapes all "/" characters which transcript testing treats as a regex escape if there isn't a "\" to esape it.
| * redirect_stderr wasn't added to contextlib until Python 3.5Todd Leonhardt2018-01-221-4/+6
| | | | | | | | So it turns out that we need contextlib2 for Python 3.4 and earlier.
| * help command temporarily redirects sys.stdout and sys.stderr to self.stdout ↵Todd Leonhardt2018-01-221-11/+23
| | | | | | | | | | | | | | | | for argparse commands In order to make "help" behave more consistently for decorated and undecorated commands, argparse output is temporarily redirected to self.stdout. So doing "help history" is similar to "help load". However, when using the "-h" with argparse commands without using the "help" command, the output from argparse isn't redirected to self.stdout. Fixing this would be rather difficult and would essentially involve creating a pyparsing rule to detect it at the parser level.
| * 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
| * History enhancementsTodd Leonhardt2018-01-201-6/+37
| | | | | | | | | | | | | | | | | | | | History changes: - Unknown commands are no longer saved in the history - history command now has a -t option to generate a transcript based on commands in the history Also: - Moved examples transcripts from examples to examples/transcripts - Added a new transcript for use with the pirate.py example
| * Added unit tests for newly-overridden complete() methodTodd Leonhardt2018-01-201-0/+8
| | | | | | | | Also added a section on Sub-commands to the documentation.
| * Added unit tests for sub-commandsTodd Leonhardt2018-01-201-1/+1
| |
| * Tab-completion of subcommand names is now supportedTodd Leonhardt2018-01-201-9/+99
| |
| * Added links to docs and examples to CHANGELOG.mdTodd Leonhardt2018-01-201-1/+1
| | | | | | | | Also bumped version to 0.8.0.
| * Added support for argparse sub-commands when using cmd2 decoratorsTodd Leonhardt2018-01-201-2/+20
| | | | | | | | | | | | | | | | | | | | | | 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.
| * Improved how new argparse-based decorators provide helpTodd Leonhardt2018-01-171-30/+21
| | | | | | | | | | | | 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.
| * Cleanup of documentation and examplesTodd Leonhardt2018-01-171-1/+0
| | | | | | | | Removed usage of and reference to attributes and commands which have now been removed.
| * Fix bug which prevented multiple history commands from being runkotfu2018-01-161-1/+1
| |
| * do_edit() no longer edits history, just files #252kotfu2018-01-161-77/+5
| |
| * Remove do_save() and do_run() for #252kotfu2018-01-161-60/+8
| |
| * Implement -o, -r, and -e options for issue #252Jared Crapo2018-01-151-10/+42
| |
| * cmdenvironment command has been removed and its functionality now exists as ↵Todd Leonhardt2018-01-151-16/+25
| | | | | | | | a -a/--all option to the set command
| * show command has been removedTodd Leonhardt2018-01-151-13/+17
| | | | | | | | | | | | It's functionality has been moved inside the set command. The set command now uses an argparse parser.
| * __relative_load command is now hidden from help menu by defaultTodd Leonhardt2018-01-151-1/+1
| |
| * Argument parsing and support currention functionality for #252kotfu2018-01-151-12/+16
| | | | | | | | still need to add support for -o, -r, and -e options.
| * Renamed new decorator to @with_argparser_and_unknown_args to make it more ↵Todd Leonhardt2018-01-151-1/+1
| | | | | | | | descriptive
| * Changed @with_argument_parser to only pass single argument to commandsTodd Leonhardt2018-01-151-20/+46
| | | | | | | | 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.
| * Just improved a few comments which had become outdatedTodd Leonhardt2018-01-151-5/+6
| |
| * Replaced @options decorator with @with_argument_list for do_editTodd Leonhardt2018-01-151-7/+11
| |
| * Made a couple cleanup changesTodd Leonhardt2018-01-151-12/+11
| | | | | | | | | | | | | | | | | | 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
| * Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglistkotfu2018-01-141-1/+5
| |\
| | * Fixed do_history unit tests and implementationTodd Leonhardt2018-01-151-1/+1
| | |