| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
now tab complete.
|
|
|
|
|
| |
Moved path_complete out of the Cmd class
Rewrote shell_complete
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
to prevent breaking change
Also:
- Reverted multilineCommands and shortcuts to class variables to prevent other breaking changes
|
| |\ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
| |
argument (which enters the submenu) and pass the rest on
to the submenu
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
So it turns out that we need contextlib2 for Python 3.4 and earlier.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| | |
Also:
- Reanamed foo and bar subcommand methods to base_foo and base_bar
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| | |
Also added a section on Sub-commands to the documentation.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Also bumped version to 0.8.0.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| | |
Removed usage of and reference to attributes and commands which have now been removed.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
a -a/--all option to the set command
|
| |
| |
| |
| |
| |
| | |
It's functionality has been moved inside the set command.
The set command now uses an argparse parser.
|
| | |
|
| |
| |
| |
| | |
still need to add support for -o, -r, and -e options.
|
| |
| |
| |
| | |
descriptive
|
| |
| |
| |
| | |
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.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |\ |
|
| | | |
|