Skip to content

Commit 76c2961

Browse files
authored
Merge pull request #420 from python-cmd2/preparse
Fixed bug where preparse() wasn't called before parsing
2 parents 8f88f81 + 12cc83b commit 76c2961

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

CHANGELOG.md

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
## 0.9.0 (TBD, 2018)
1+
## 0.9.0 (May TBD, 2018)
22
* Bug Fixes
33
* If self.default_to_shell is true, then redirection and piping are now properly passed to the shell. Previously it was truncated.
44
* Submenus now call all hooks, it used to just call precmd and postcmd.
5-
* Fixed ``AttributeError`` on Windows when running a ``select`` command cause by **pyreadline** not implementing ``remove_history_item``
65
* Enhancements
76
* Automatic completion of ``argparse`` arguments via ``cmd2.argparse_completer.AutoCompleter``
87
* See the [tab_autocompletion.py](https://github.com/python-cmd2/cmd2/blob/master/examples/tab_autocompletion.py) example for a demonstration of how to use this feature
@@ -17,9 +16,6 @@
1716
* ``identchars`` is now ignored. The standardlibrary cmd uses those characters to split the first "word" of the input, but cmd2 hasn't used those for a while, and the new parsing logic parses on whitespace, which has the added benefit of full unicode support, unlike cmd or prior versions of cmd2.
1817
* ``set_posix_shlex`` function and ``POSIX_SHLEX`` variable have been removed. Parsing behavior is now always the more forgiving ``posix=false``.
1918
* ``set_strip_quotes`` function and ``STRIP_QUOTES_FOR_NON_POSIX`` have been removed. Quotes are stripped from arguments when presented as a list (a la ``sys.argv``), and present when arguments are presented as a string (like the string passed to do_*).
20-
* Enhanced the ``py`` console in the following ways
21-
* Added tab completion of Python identifiers instead of **cmd2** commands
22-
* Separated the ``py`` console history from the **cmd2** history
2319
* Changes
2420
* ``strip_ansi()`` and ``strip_quotes()`` functions have moved to new utils module
2521
* Several constants moved to new constants module
@@ -34,11 +30,24 @@
3430
* Replaced by default AutoCompleter implementation for all commands using argparse
3531
* Deleted support for old method of calling application commands with ``cmd()`` and ``self``
3632
* ``cmd2.redirector`` is no longer supported. Output redirection can only be done with '>' or '>>'
33+
* Deleted ``postparse()`` hook since it was redundant with ``postparsing_precmd``
3734
* Python 2 no longer supported
3835
* ``cmd2`` now supports Python 3.4+
3936
* Known Issues
4037
* Some developers have noted very slow performance when importing the ``cmd2`` module. The issue
4138
it intermittant, and investigation of the root cause is ongoing.
39+
40+
## 0.8.6 (May 27, 2018)
41+
* Bug Fixes
42+
* Commands using the @with_argparser_and_unknown_args were not correctly recognized when tab completing
43+
* Fixed issue where completion display function was overwritten when a submenu quits
44+
* Fixed ``AttributeError`` on Windows when running a ``select`` command cause by **pyreadline** not implementing ``remove_history_item``
45+
* Enhancements
46+
* Added warning about **libedit** variant of **readline** not being supported on macOS
47+
* Added tab-completion of alias names in value filed of **alias** command
48+
* Enhanced the ``py`` console in the following ways
49+
* Added tab completion of Python identifiers instead of **cmd2** commands
50+
* Separated the ``py`` console history from the **cmd2** history
4251

4352
## 0.8.5 (April 15, 2018)
4453
* Bug Fixes

cmd2/cmd2.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,15 +1619,6 @@ def preparse(self, raw: str) -> str:
16191619
"""
16201620
return raw
16211621

1622-
# noinspection PyMethodMayBeStatic
1623-
def postparse(self, statement: Statement) -> Statement:
1624-
"""Hook that runs immediately after parsing the user input.
1625-
1626-
:param statement: Statement object populated by parsing
1627-
:return: Statement - potentially modified Statement object
1628-
"""
1629-
return statement
1630-
16311622
# noinspection PyMethodMayBeStatic
16321623
def postparsing_precmd(self, statement: Statement) -> Tuple[bool, Statement]:
16331624
"""This runs after parsing the command-line, but before anything else; even before adding cmd to history.

docs/hooks.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ the various hook methods, presented in chronological order starting with the one
5050

5151
.. automethod:: cmd2.cmd2.Cmd.preparse
5252

53-
.. automethod:: cmd2.cmd2.Cmd.postparse
54-
5553
.. automethod:: cmd2.cmd2.Cmd.postparsing_precmd
5654

5755
.. automethod:: cmd2.cmd2.Cmd.precmd

0 commit comments

Comments
 (0)