Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
51b740d
First version of allowing quotes in tab completion
kmvanbrunt Mar 17, 2018
adbcec5
Merge branch 'master' into quoted_completion
kmvanbrunt Mar 17, 2018
b0480b3
Forgot a flag check
kmvanbrunt Mar 17, 2018
0966c88
More progress
kmvanbrunt Mar 18, 2018
cafdc1c
Backing up work
kmvanbrunt Mar 18, 2018
221deb8
Merge branch 'master' into quoted_completion
tleonhardt Mar 18, 2018
6ac3d49
Trying to change readline variable
kmvanbrunt Mar 18, 2018
3931341
Merge branch 'quoted_completion' of github.com:python-cmd2/cmd2 into …
kmvanbrunt Mar 18, 2018
25ce7ea
Merging stuff from other branches
kmvanbrunt Mar 18, 2018
b55f598
Fixed unit test
kmvanbrunt Mar 18, 2018
78073c4
Merging in tests
kmvanbrunt Mar 18, 2018
41ae7e9
GNU readline hack to prevent automatically closing quotes
kmvanbrunt Mar 19, 2018
1c59c15
Updated complete_shell to handle spaces in exes
kmvanbrunt Mar 19, 2018
51b9056
Updated remaining completion functions to handle spaces within quotes
kmvanbrunt Mar 19, 2018
c15a3fc
Fixed Pycharm warnings
kmvanbrunt Mar 19, 2018
f691fde
Changed when a closing quote is added
kmvanbrunt Mar 19, 2018
b33961f
Don't try to tab complete when the cursor is right after a closed quote
kmvanbrunt Mar 19, 2018
413b04f
Fixed pycharm warnings
kmvanbrunt Mar 19, 2018
6b95022
Added unit tests for new completers
kmvanbrunt Mar 19, 2018
07af2ee
Allowing quotes in help command
kmvanbrunt Mar 19, 2018
44c38e3
Added unit tests for completions with quotes
kmvanbrunt Mar 19, 2018
c2a3f67
More quoted completion unit tests
kmvanbrunt Mar 19, 2018
0310ec7
Unit test for cursor right after closing quote
kmvanbrunt Mar 19, 2018
42fbd78
First steps toward automatically added opening quote
kmvanbrunt Mar 20, 2018
0c367e1
Appending closing quote and space when needed
kmvanbrunt Mar 20, 2018
be197be
Simplified function that tokenizes for tab completion
kmvanbrunt Mar 20, 2018
892ba85
Updated unit tests to reflect new completion behavior
kmvanbrunt Mar 20, 2018
e674ed6
Fixed unit test
kmvanbrunt Mar 20, 2018
bc28141
Adding opening quote with GNU readline
kmvanbrunt Mar 20, 2018
2a3c792
Automatically adding an opening quote if needed during tab completion
kmvanbrunt Mar 20, 2018
7900be9
Not altering copy of completion_token
kmvanbrunt Mar 20, 2018
c1b8776
Renamed variable
kmvanbrunt Mar 20, 2018
5e7d9c3
Merge branch 'master' into quoted_completion
kmvanbrunt Mar 20, 2018
213afe5
Using same completer delimiters. Added customization for how tab-comp…
kmvanbrunt Mar 20, 2018
8ba1e4e
Made path completion work with tildes again
kmvanbrunt Mar 20, 2018
7c56341
Fixed some unit tests
kmvanbrunt Mar 20, 2018
4203c2f
Made cmd2.py executable
kmvanbrunt Mar 20, 2018
88cd9e9
Fixed index bug
kmvanbrunt Mar 20, 2018
62d558d
Fixed Windows since pyreadline does not implement set_completion_disp…
kmvanbrunt Mar 20, 2018
3617748
Expanded do_shell parsing of command
kmvanbrunt Mar 21, 2018
0e927cc
Merge branch 'master' into quoted_completion
kmvanbrunt Mar 21, 2018
58a2248
Returning on error
kmvanbrunt Mar 21, 2018
8f91bf2
Fixed unit test failure on Python 2.7
tleonhardt Mar 21, 2018
b95a21f
Made sure quoting of a token works on Python 2.7.
kmvanbrunt Mar 21, 2018
d907c77
Updated comments
kmvanbrunt Mar 21, 2018
f4570b6
Renamed a function
kmvanbrunt Mar 21, 2018
57e53ee
shutil.get_terminal_size does not exist before Python 3.3
kmvanbrunt Mar 21, 2018
0014b4d
Added generic code for getting terminal size for Python versions prio…
tleonhardt Mar 21, 2018
1240d0a
Fixed issue where display matches were not being set
kmvanbrunt Mar 21, 2018
109101d
Corrected display_entire_match behavior. A bit of refactoring.
kmvanbrunt Mar 21, 2018
6ff3d2f
Fixed check for unclosed quote
kmvanbrunt Mar 21, 2018
2ad0587
Fixed Pycharm warnings
kmvanbrunt Mar 21, 2018
baccdf5
Merge branch 'master' into new_quoted_completion
kmvanbrunt Mar 21, 2018
6d6651c
Updating unit tests for new tab completion behavior
kmvanbrunt Mar 21, 2018
029e0a2
Merge branch 'master' into new_quoted_completion
kmvanbrunt Mar 21, 2018
781d2c5
Don't try to look for subcommands on something that is running as a s…
kmvanbrunt Mar 21, 2018
02e2467
More unit test fixing
kmvanbrunt Mar 21, 2018
feb9dc3
More unit test updates
kmvanbrunt Mar 21, 2018
2f41049
Fixed all path matching unit tests
kmvanbrunt Mar 22, 2018
2db4fb3
Finished basic, flag, and index completion unit tests
kmvanbrunt Mar 22, 2018
fc500f1
Added better analysis of tab completing shell commands
kmvanbrunt Mar 22, 2018
709217c
Finished subcommand completion unit tests
kmvanbrunt Mar 22, 2018
c9e4e39
All existing tab completion unit tests work
kmvanbrunt Mar 22, 2018
3f945dc
Fixed Python 2.7 issue
kmvanbrunt Mar 22, 2018
f3cc99c
Increased coverage of completion tests
kmvanbrunt Mar 22, 2018
1cb8b2d
Merge branch 'master' into new_quoted_completion
kmvanbrunt Mar 22, 2018
9d724f2
Make sure completion tokens are never empty
kmvanbrunt Mar 22, 2018
a73e6df
Renamed exclude_from_help to hidden_commands
kmvanbrunt Mar 22, 2018
bf05e5d
Fixed unit tests
kmvanbrunt Mar 22, 2018
54073dd
Added get_all_commands
kmvanbrunt Mar 22, 2018
fb7171a
Fixed GNU readline issue where the prompt did not always redraw properly
kmvanbrunt Mar 22, 2018
f293bbe
Letting readline know we updated the display
kmvanbrunt Mar 22, 2018
65a6482
Added ability to write custom match display functions
kmvanbrunt Mar 23, 2018
b9c188a
Renamed completions to matches
kmvanbrunt Mar 23, 2018
4f21fe8
Added shell_cmd_complete() as a stand alone tab-completion function.
kmvanbrunt Mar 23, 2018
51da5c8
Added an extra parsing check
kmvanbrunt Mar 23, 2018
43cc4f7
Updated documentation
kmvanbrunt Mar 23, 2018
ac64f1b
Improved token parsing for tab completion
kmvanbrunt Mar 23, 2018
973f666
Fixed issue with negative indexes
kmvanbrunt Mar 23, 2018
0a16f8a
Using shlex.split() again since filenames were being split on periods
kmvanbrunt Mar 23, 2018
55fa6ee
Merge branch 'master' into new_quoted_completion
kmvanbrunt Mar 23, 2018
ab865b4
Returning both the unquoted and raw tokens for tab completion
kmvanbrunt Mar 24, 2018
94000bf
Reversed logic for readability
kmvanbrunt Mar 24, 2018
7ffa5f8
Renamed variable for clarity
kmvanbrunt Mar 24, 2018
6cb8fe4
Simplifying the code by calling readline functions directly.
kmvanbrunt Mar 24, 2018
c65ece9
Moving code
kmvanbrunt Mar 24, 2018
da7d7b5
Removed unused variable
kmvanbrunt Mar 24, 2018
bd5fbf9
Moved all completer functions into cmd2 since they will now depend on…
kmvanbrunt Mar 24, 2018
40f8a84
Remove unneeded use of functools.partial
kmvanbrunt Mar 24, 2018
efd3b2c
Made subcommand specific completion work with Python 2 in the examples
kmvanbrunt Mar 24, 2018
adc0ce8
Moving toward properly tab completing redirections
kmvanbrunt Mar 25, 2018
40ca5eb
Merge branch 'master' into new_quoted_completion
kmvanbrunt Mar 25, 2018
4701a39
Updated documentation
kmvanbrunt Mar 25, 2018
1ebf869
Handling redirection characters in tab completion tokenizing
kmvanbrunt Mar 25, 2018
be6af1c
Added functions to set realine line buffer and cursor offset
kmvanbrunt Mar 25, 2018
826b049
Added completion for redirection to every command
kmvanbrunt Mar 25, 2018
2d111d8
Improved parsing for tab completing redirectors
kmvanbrunt Mar 25, 2018
f4a1c32
Removed unused imports
kmvanbrunt Mar 26, 2018
0addec3
Fixing unit tests
kmvanbrunt Mar 26, 2018
8082d98
Removed unit test
kmvanbrunt Mar 26, 2018
eb851f4
All completer routines now receive the entire token being completed i…
kmvanbrunt Mar 26, 2018
f5e009e
Fixed indexing bug and unit test
kmvanbrunt Mar 26, 2018
113da63
Added logic for choosing quote type
kmvanbrunt Mar 26, 2018
48b21fc
Allowing multiple redirectors when tab completing
kmvanbrunt Mar 26, 2018
bebf547
Added delimiter_complete function
kmvanbrunt Mar 26, 2018
967c768
Updated comment
kmvanbrunt Mar 26, 2018
5116720
Updated change log
kmvanbrunt Mar 26, 2018
2b4f94f
Simplified code
kmvanbrunt Mar 27, 2018
1dbecfb
Restoring all changes to readline before command loop exits
kmvanbrunt Mar 27, 2018
6b2e975
Added unit tests
kmvanbrunt Mar 27, 2018
a16cbaf
Added more unit tests
kmvanbrunt Mar 27, 2018
ce76120
Reorganized some unit tests
kmvanbrunt Mar 27, 2018
0ef0e9b
Fixed a case where display_matches wasn't being set. Added unit tests.
kmvanbrunt Mar 27, 2018
88ce0b5
Added checks for readline implementation type
kmvanbrunt Mar 27, 2018
554561b
Addressed code review comments
kmvanbrunt Mar 28, 2018
d78dc46
Simplified how to add tab completion to a subcommand
kmvanbrunt Mar 28, 2018
92ab77c
Merge branch 'master' into new_quoted_completion
kmvanbrunt Mar 28, 2018
fd14639
Add conditional dependency on enum34 for Python 2.7
tleonhardt Mar 28, 2018
39c45f8
Simplified the readline lib loading
kmvanbrunt Mar 29, 2018
4c2e918
Updated comment
kmvanbrunt Mar 29, 2018
bf11c16
Fixed a comment a made a line more readable
kmvanbrunt Mar 29, 2018
cd0674f
Fixed comment
kmvanbrunt Mar 29, 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
27 changes: 25 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 0.8.3 (TBD)
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. If you want, there is probably enough in this PR to constitute a release in and of itself.

* Bug Fixes
* Fixed ``help`` command not calling functions for help topics
* Fixed not being able to use quoted paths when redirecting with ``<`` and ``>``

* Enhancements
* Tab completion has been overhauled and now supports completion of strings with quotes and spaces.
* Tab completion will automatically add an opening quote if a string with a space is completed.
* Added ``delimiter_complete`` function for tab completing delimited strings
* Added more control over tab completion behavior including the following flags. The use of these flags is documented in cmd2.py
* ``allow_appended_space``
* ``allow_closing_quote``

* Attribute Changes (Breaks backward compatibility)
* ``exclude_from_help`` is now called ``hidden_commands`` since these commands are hidden from things other than help, including tab completion
* This list also no longer takes the function names of commands (``do_history``), but instead uses the command names themselves (``history``)
* ``excludeFromHistory`` is now called ``exclude_from_history``
* ``cmd_with_subs_completer()`` no longer takes an argument called ``base``. Adding tab completion to subcommands has been simplified to declaring it in the
subcommand parser's default settings. This easily allows arbitrary completers like path_complete to be used.
See [subcommands.py](https://github.com/python-cmd2/cmd2/blob/master/examples/subcommands.py) for an example of how to use
tab completion in subcommands. In addition, the docstring for ``cmd_with_subs_completer()`` offers more details.


## 0.8.2 (March 21, 2018)

* Bug Fixes
Expand All @@ -14,7 +37,7 @@
* See [alias_startup.py](https://github.com/python-cmd2/cmd2/blob/master/examples/alias_startup.py) for an example
* Added a default SIGINT handler which terminates any open pipe subprocesses and re-raises a KeyboardInterrupt
* For macOS, will load the ``gnureadline`` module if available and ``readline`` if not

## 0.8.1 (March 9, 2018)

* Bug Fixes
Expand Down Expand Up @@ -56,7 +79,7 @@
* 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/argparse_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
* Added support for Argparse 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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ 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.
All commands will automatically be tracked in the session's history, unless the command is listed in Cmd's exclude_from_history attribute.
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`.
to the list at `Cmd.exclude_from_history`.

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

Expand Down
Loading