File tree Expand file tree Collapse file tree 4 files changed +16
-8
lines changed
Expand file tree Collapse file tree 4 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 3434 * Never - output methods strip all ANSI escape sequences
3535 * Added `` macro `` command to create macros, which are similar to aliases, but can take arguments when called
3636 * All cmd2 command functions have been converted to use argparse.
37+ * Renamed argparse_example.py to decorator_example.py to help clarify its intent
3738* Deprecations
3839 * Deprecated the built-in `` cmd2 `` support for colors including `` Cmd.colorize() `` and `` Cmd._colorcodes ``
3940* Deletions (potentially breaking changes)
Original file line number Diff line number Diff line change @@ -15,11 +15,11 @@ Argument Processing
1515
1616These features are all provided by the ``@with_argparser `` decorator which is importable from ``cmd2 ``.
1717
18- See the either the argprint _ or argparse _ example to learn more about how to use the various ``cmd2 `` argument
18+ See the either the argprint _ or decorator _ example to learn more about how to use the various ``cmd2 `` argument
1919processing decorators in your ``cmd2 `` applications.
2020
2121.. _argprint : https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py
22- .. _ argparse : https://github.com/python-cmd2/cmd2/blob/master/examples/argparse_example .py
22+ .. _ decorator : https://github.com/python-cmd2/cmd2/blob/master/examples/decorator_example .py
2323
2424Using the argument parser decorator
2525===================================
@@ -171,6 +171,14 @@ Which yields:
171171
172172 This command can not generate tags with no content, like <br/>
173173
174+ .. warning ::
175+
176+ If a command **foo ** is decorated with one of cmd2's argparse decorators, then **help_foo ** will not
177+ be invoked when ``help foo `` is called. The argparse _ module provides a rich API which can be used to
178+ tweak every aspect of the displayed help and we encourage ``cmd2 `` developers to utilize that.
179+
180+ .. _argparse : https://docs.python.org/3/library/argparse.html
181+
174182
175183Grouping Commands
176184=================
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22# coding=utf-8
3- """A sample application for cmd2 showing how to use argparse to
3+ """A sample application showing how to use cmd2's argparse decorators to
44process command line arguments for your application.
55
66Thanks to cmd2's built-in transcript testing capability, it also
7- serves as a test suite for argparse_example.py when used with the
8- exampleSession.txt transcript.
7+ serves as a test suite when used with the exampleSession.txt transcript.
98
10- Running `python argparse_example .py -t exampleSession.txt` will run
11- all the commands in the transcript against argparse_example .py,
9+ Running `python decorator_example .py -t exampleSession.txt` will run
10+ all the commands in the transcript against decorator_example .py,
1211verifying that the output produced matches the transcript.
1312"""
1413import argparse
Original file line number Diff line number Diff line change 1- # Run this transcript with "python argparse_example .py -t exampleSession.txt"
1+ # Run this transcript with "python decorator_example .py -t exampleSession.txt"
22# The regex for colors is because no color on Windows.
33# The regex for editor will match whatever program you use.
44# regexes on prompts just make the trailing space obvious
You can’t perform that action at this time.
0 commit comments