Skip to content

Sub-commands and automatic transcript generation #257

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
## 0.8.0 (TBD, 2018)
* Bug Fixes
* Fixed unit tests on Python 3.7 due to changes in how re.escape() behaves in Python 3.7
* Fixed a bug where unknown commands were getting saved in the history
* Enhancements
* Three new decorators for **do_*** commands to make argument parsing easier
* **with_argument_list** decorator to change argument type from str to List[str]
* **do_*** commands get a single argument which is a list of strings, as pre-parsed by shlex.split()
* **with_argument_parser** decorator for strict argparse-based argument parsing of command arguments
* **do_*** commands get a single argument which is the output of argparse.parse_args()
* **with_argparser_and_unknown_args** decorator for argparse-based argument parsing, but allowing unknown args
* **with_argparser_and_unknown_args** decorator for argparse-based argument parsing, but allows unknown args
* **do_*** commands get two arguments, the output of argparse.parse_known_args()
* See the **Argument Processing** section of the documentation for more information on these decorators
* Alternatively, see the **argparse_example.py** and **arg_print.py** examples
* See the [Argument Processing](http://cmd2.readthedocs.io/en/latest/argument_processing.html) section of the documentation for more information on these decorators
* Alternatively, see the [argparse_example.py](https://github.com/python-cmd2/cmd2/blob/master/examples/argpasre_example.py)
and [arg_print.py](https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py) examples
* Added support for Argpasre sub-commands when using the **with_argument_parser** or **with_argparser_and_unknown_args** decorators
* See [subcommands.py](https://github.com/python-cmd2/cmd2/blob/master/examples/subcommands.py) for an example of how to use subcommands
* Tab-completion of sub-command names is automatically supported
* The **__relative_load** command is now hidden from the help menu by default
* This command is not intended to be called from the command line, only from within scripts
* The **set** command now has an additional **-a/--all** option to also display read-only settings
* The **history** command can now run, edit, and save prior commands, in addition to the prior behavior of displaying prior commands.
* The **history** command can now run, edit, and save prior commands, in addition to displaying prior commands.
* The **history** command can now automatically generate a transcript file for regression testing
* This feature works imperfectly at the moment, but it is still quite useful
* Commands Removed
* The **cmdenvironment** has been removed and its functionality incorporated into the **-a/--all** argument to **set**
* The **show** command has been removed. Its functionality has always existing within **set** and continues to do so
* The **save** command has been removed. The capability to save prior commands is now part of the **history** command.
* The **save** command has been removed. The capability to save commands is now part of the **history** command.
* The **run** command has been removed. The capability to run prior commands is now part of the **history** command.
* Other changes
* The **edit** command no longer allows you to edit prior commands. The capability to edit prior commands is now part of the **history** command. The **edit** command still allows you to edit arbitrary files.
* the **autorun_on_edit** setting has been removed.
* For Python 3.4 and earlier, ``cmd2`` now has an additional dependency on the ``contextlib2`` module
* Deprecations
* The old **options** decorator for optparse-based argument parsing is now *deprecated*
* The old decorator is still present for now, but will eventually be removed in a future release
* ``cmd2`` no longer includes **optparse.make_option** so if your app needs it you need to import it directly from optparse

* The old decorator is still present for now, but will be removed in a future release
* ``cmd2`` no longer includes **optparse.make_option**, so if your app needs it import directly from optparse

## 0.7.9 (January 4, 2018)

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ Main Features
- Multi-line, case-insensitive, and abbreviated commands
- Special-character command shortcuts (beyond cmd's `@` and `!`)
- Settable environment parameters
- Parsing commands with arguments using `argparse`
- Parsing commands with arguments using `argparse`, including support for sub-commands
- Unicode character support (*Python 3 only*)
- Good tab-completion of commands, file system paths, and shell commands
- Good tab-completion of commands, sub-commands, file system paths, and shell commands
- Python 2.7 and 3.4+ support
- Linux, macOS and Windows support
- Windows, macOS, and Linux support
- Trivial to provide built-in help for all commands
- Built-in regression testing framework for your applications (transcript-based testing)

Expand All @@ -48,8 +48,9 @@ pip install -U cmd2

cmd2 works with Python 2.7 and Python 3.4+ on Windows, macOS, and Linux. It is pure Python code with
the only 3rd-party dependencies being on [six](https://pypi.python.org/pypi/six),
[pyparsing](http://pyparsing.wikispaces.com), and [pyperclip](https://github.com/asweigart/pyperclip)
(on Windows, [pyreadline](https://pypi.python.org/pypi/pyreadline) is an additional dependency).
[pyparsing](http://pyparsing.wikispaces.com), and [pyperclip](https://github.com/asweigart/pyperclip).
Windows has an additional dependency on [pyreadline](https://pypi.python.org/pypi/pyreadline) and Python
3.4 and earlier have an additional dependency on [contextlib2](https://pypi.python.org/pypi/contextlib2).

For information on other installation options, see
[Installation Instructions](https://cmd2.readthedocs.io/en/latest/install.html) in the cmd2
Expand Down
Loading