-
Notifications
You must be signed in to change notification settings - Fork 124
decorator changes for replacing optparse with argparse #249
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
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 c26b008
new @with_argument_list decorator
kotfu 405f4e4
add use_argument_list setting
kotfu cab8a16
more robust argparse and arglist decorators
kotfu c69216b
Ensure help function works if use_argument_list = True
kotfu 144ebaa
Convert built-in commands to argparsing for #250
kotfu 22b4f4a
refactor onecmd() to use parse_quoted_string()
kotfu eac6929
remove use_argument_list attribute
kotfu 0e77f4b
convert do_history() to argparse
kotfu fda7300
convert do_show() to argparse
kotfu ddac998
Fixed @with_argument_decorator so that built-in help text is preserved
tleonhardt 07e37b2
Fixed do_history unit tests and implementation
tleonhardt 6454f4e
convert do_pyscript() to use @with_argument_list
kotfu eb12773
Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglist
kotfu 6b5d362
Fixed test_echo unit test
tleonhardt 2fcc883
Fixed base_invalid_option unit test
tleonhardt 141d951
Made a couple cleanup changes
tleonhardt cb412f6
Replaced @options decorator with @with_argument_list for do_edit
tleonhardt b4e6fc4
Modified examples still using @options to import make_option from opt…
tleonhardt aec6704
Just improved a few comments which had become outdated
tleonhardt eee2d62
Changed @with_argument_parser to only pass single argument to commands
tleonhardt 1f18c94
Renamed new decorator to @with_argparser_and_unknown_args to make it …
tleonhardt b51d31b
Just updated the CHANGELOG a little to reflect ongoing changes
tleonhardt da0a448
Updated README.md due to @withargument_parser decorator now only pass…
tleonhardt 38989c8
Added a unit test
tleonhardt 2210968
Argument parsing and support currention functionality for #252
kotfu c6a19be
Merge branch 'arglist' of github.com:python-cmd2/cmd2 into arglist
kotfu 8d9c281
__relative_load command is now hidden from help menu by default
tleonhardt f2d887f
Fixed expected value of "help history" for unit tests
tleonhardt a8e79fd
Made test_echo unit test robust to changes in expected value of "help…
tleonhardt 1d1c55b
show command has been removed
tleonhardt b89cbb4
Fixed the test_transcript unit test when run with the from_cmdloop.tx…
tleonhardt f7cc161
cmdenvironment command has been removed and its functionality now exi…
tleonhardt d588bd1
Revised some of the Sphinx documentation which referenced the depreca…
tleonhardt e14f628
Fix test_base_show_readonly unit test on Windows
tleonhardt e3bc19f
Fixed comment in README.md that referred to the "list" command which …
tleonhardt cb7269f
Implement -o, -r, and -e options for issue #252
kotfu 60890fa
tweak unit tests for history #252
kotfu d8ade12
Remove do_save() and do_run() for #252
kotfu fd5750f
do_edit() no longer edits history, just files #252
kotfu 01596cb
Update changelog with #252 changes
kotfu 51e7176
Fix bug which prevented multiple history commands from being run
kotfu 1da9045
Cleanup of documentation and examples
tleonhardt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
||
|
|
@@ -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: | ||
|
|
@@ -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: | ||
|
|
@@ -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)): | ||
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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