Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
19c0586
@with_argument_parser now passes an arglist instead of a string
kotfu Jan 13, 2018
c26b008
new @with_argument_list decorator
kotfu Jan 13, 2018
405f4e4
add use_argument_list setting
kotfu Jan 13, 2018
cab8a16
more robust argparse and arglist decorators
kotfu Jan 14, 2018
c69216b
Ensure help function works if use_argument_list = True
kotfu Jan 14, 2018
144ebaa
Convert built-in commands to argparsing for #250
kotfu Jan 15, 2018
22b4f4a
refactor onecmd() to use parse_quoted_string()
kotfu Jan 15, 2018
eac6929
remove use_argument_list attribute
kotfu Jan 15, 2018
0e77f4b
convert do_history() to argparse
kotfu Jan 15, 2018
fda7300
convert do_show() to argparse
kotfu Jan 15, 2018
ddac998
Fixed @with_argument_decorator so that built-in help text is preserved
tleonhardt Jan 15, 2018
07e37b2
Fixed do_history unit tests and implementation
tleonhardt Jan 15, 2018
6454f4e
convert do_pyscript() to use @with_argument_list
kotfu Jan 15, 2018
eb12773
Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglist
kotfu Jan 15, 2018
6b5d362
Fixed test_echo unit test
tleonhardt Jan 15, 2018
2fcc883
Fixed base_invalid_option unit test
tleonhardt Jan 15, 2018
141d951
Made a couple cleanup changes
tleonhardt Jan 15, 2018
cb412f6
Replaced @options decorator with @with_argument_list for do_edit
tleonhardt Jan 15, 2018
b4e6fc4
Modified examples still using @options to import make_option from opt…
tleonhardt Jan 15, 2018
aec6704
Just improved a few comments which had become outdated
tleonhardt Jan 15, 2018
eee2d62
Changed @with_argument_parser to only pass single argument to commands
tleonhardt Jan 15, 2018
1f18c94
Renamed new decorator to @with_argparser_and_unknown_args to make it …
tleonhardt Jan 15, 2018
b51d31b
Just updated the CHANGELOG a little to reflect ongoing changes
tleonhardt Jan 15, 2018
da0a448
Updated README.md due to @withargument_parser decorator now only pass…
tleonhardt Jan 15, 2018
38989c8
Added a unit test
tleonhardt Jan 15, 2018
2210968
Argument parsing and support currention functionality for #252
kotfu Jan 15, 2018
c6a19be
Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglist
kotfu Jan 15, 2018
8d9c281
__relative_load command is now hidden from help menu by default
tleonhardt Jan 15, 2018
f2d887f
Fixed expected value of "help history" for unit tests
tleonhardt Jan 15, 2018
a8e79fd
Made test_echo unit test robust to changes in expected value of "help…
tleonhardt Jan 15, 2018
1d1c55b
show command has been removed
tleonhardt Jan 15, 2018
b89cbb4
Fixed the test_transcript unit test when run with the from_cmdloop.tx…
tleonhardt Jan 15, 2018
f7cc161
cmdenvironment command has been removed and its functionality now exi…
tleonhardt Jan 15, 2018
d588bd1
Revised some of the Sphinx documentation which referenced the depreca…
tleonhardt Jan 15, 2018
e14f628
Fix test_base_show_readonly unit test on Windows
tleonhardt Jan 15, 2018
e3bc19f
Fixed comment in README.md that referred to the "list" command which …
tleonhardt Jan 15, 2018
cb7269f
Implement -o, -r, and -e options for issue #252
kotfu Jan 16, 2018
60890fa
tweak unit tests for history #252
kotfu Jan 16, 2018
d8ade12
Remove do_save() and do_run() for #252
kotfu Jan 17, 2018
fd5750f
do_edit() no longer edits history, just files #252
kotfu Jan 17, 2018
01596cb
Update changelog with #252 changes
kotfu Jan 17, 2018
51e7176
Fix bug which prevented multiple history commands from being run
kotfu Jan 17, 2018
1da9045
Cleanup of documentation and examples
tleonhardt Jan 17, 2018
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
31 changes: 26 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,32 @@
* Bug Fixes
* Fixed unit tests on Python 3.7 due to changes in how re.escape() behaves in Python 3.7
* Enhancements
* Added new **with_argument_parser** decorator for argparse-based argument parsing of command arguments
* This replaces the old **options** decorator for optparse-based argument parsing
* The old decorator is still present for now, but should be considered *deprecated* and will eventually be removed
* See the **Argument Processing** section of the documentation for more information
* Alternatively, see the **argparse_example.py** example
* Three new decorators for **do_*** commands to make argument parsing easier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating the Changelog

* **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
* **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
* 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.
* 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 **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.
* 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


## 0.7.9 (January 4, 2018)

Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ Instructions for implementing each feature follow.
- Searchable command history

All commands will automatically be tracked in the session's history, unless the command is listed in Cmd's excludeFromHistory attribute.
The history is accessed through the `history`, `list`, and `run` commands.
The history is accessed through the `history` command.
If you wish to exclude some of your custom commands from the history, append their names
to the list at `Cmd.ExcludeFromHistory`.

- Load commands from file, save to file, edit commands in file

Type `help load`, `help save`, `help edit` for details.
Type `help load`, `help history` for details.

- Multi-line commands

Expand Down Expand Up @@ -105,7 +105,7 @@ Instructions for implementing each feature follow.
argparser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE')
argparser.add_argument('words', nargs='+', help='words to say')
@with_argument_parser(argparser)
def do_speak(self, cmdline, args=None):
def do_speak(self, args):
"""Repeats what you tell me to."""
words = []
for word in args.words:
Expand Down Expand Up @@ -175,7 +175,7 @@ class CmdLineApp(Cmd):
argparser.add_argument('-r', '--repeat', type=int, help='output [n] times')
argparser.add_argument('words', nargs='+', help='words to say')
@with_argument_parser(argparser)
def do_speak(self, cmdline, opts=None):
def do_speak(self, args):
"""Repeats what you tell me to."""
words = []
for word in args.words:
Expand All @@ -196,7 +196,7 @@ class CmdLineApp(Cmd):
argparser.add_argument('-r', '--repeat', type=int, help='how many times to repeat')
argparser.add_argument('words', nargs='+', help='words to say')
@with_argument_parser(argparser)
def do_mumble(self, cmdline, args=None):
def do_mumble(self, args):
"""Mumbles what you tell me to."""
repetitions = args.repeat or 1
for i in range(min(repetitions, self.maxrepeats)):
Expand Down Expand Up @@ -236,7 +236,6 @@ example/transcript_regex.txt:
# regexes on prompts just make the trailing space obvious
(Cmd) set
abbrev: True
autorun_on_edit: False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My recent commit was just a minor cleanup of documentation and such

colors: /(True|False)/
continuation_prompt: >/ /
debug: False
Expand Down
Loading