Releases: python-cmd2/cmd2
Releases · python-cmd2/cmd2
0.9.24 (January 23, 2020)
- Enhancements
- Flushing stderr when setting the window title and printing alerts for better responsiveness in cases where stderr is not unbuffered.
- Added function to truncate a single line to fit within a given display width.
cmd2.utils.truncate_line
supports characters with display widths greater than 1 and ANSI style sequences. - Added line truncation support to
cmd2.utils
text alignment functions. - Added support for Python 3.9 alpha
0.9.23 (January 9, 2020)
- Bug Fixes
- Fixed bug where startup script containing a single quote in its file name was incorrectly quoted
- Added missing implicit dependency on
setuptools
due to build withsetuptools_scm
- Enhancements
- Added dim text style support via
style()
function andansi.INTENSITY_DIM
setting.
- Added dim text style support via
- Breaking changes
- Renamed the following
ansi
members for accuracy in what types of ANSI escape sequences are handledansi.allow_ansi
->ansi.allow_style
ansi.ansi_safe_wcswidth()
->ansi.style_aware_wcswidth()
ansi.ansi_aware_write()
->ansi.style_aware_write()
- Renamed the following
ansi
members for clarificationansi.BRIGHT
->ansi.INTENSITY_BRIGHT
ansi.NORMAL
->ansi.INTENSITY_NORMAL
- Renamed the following
0.9.22 (December 9, 2019)
- Bug Fixes
- Fixed bug where a redefined
ansi.style_error
was not being used in allcmd2
files
- Fixed bug where a redefined
- Enhancements
- Enabled line buffering when redirecting output to a file
- Added
align_left()
,align_center()
, andalign_right()
to utils.py. All 3 of these functions support ANSI escape sequences and characters with display widths greater than 1. They wrapalign_text()
which is also in utils.py.
0.9.21 (November 26, 2019)
- Bug Fixes
- Fixed bug where pipe processes were not being stopped by Ctrl-C
- Added exception handling to account for non-standard Python environments in which readline is not loaded dynamically from a shared library file
- Enhancements
- Added
read_input()
function that is used to read from stdin. Unlike the Python built-ininput()
, it also has an argument to disable tab completion while input is being entered. - Added capability to override the argument parser class used by cmd2 built-in commands. See override_parser.py example for more details.
- Added
end
argument topfeedback()
to be consistent with the other print functions likepoutput()
. - Added
apply_style
topwarning()
.
- Added
- Breaking changes
- For consistency between all the print functions:
- Made
end
andchop
keyword-only arguments ofppaged()
end
is always added to message inppaged()
- Made
- For consistency between all the print functions:
0.9.20 (November 12, 2019)
- Bug Fixes
- Fixed bug where setting
use_ipython
to False removed ipy command from the entirecmd2.Cmd
class instead of just the instance being created - Fix bug where cmd2 ran 'stty sane' command when stdin was not a terminal
- Fixed bug where setting
- Enhancements
- Send all startup script paths to run_script. Previously we didn't do this if the file was empty, but that showed no record of the run_script command in history.
- Made it easier for developers to override
edit
command by havingdo_history
no longer calldo_edit
. This also removes the need to excludeedit
command from history list. - It is no longer necessary to set the
prog
attribute of an argparser with subcommands. cmd2 now automatically sets the prog value of it and all its subparsers so that all usage statements contain the top level command name and not sys.argv[0].
- Breaking changes
- Some constants were moved from cmd2.py to constants.py
- cmd2 command decorators were moved to decorators.py. If you were importing them via cmd2's __init__.py, then there will be no issues.
0.9.19 (October 14, 2019)
- Bug Fixes
- Fixed
ValueError
exception which could occur when an old format persistent history file is loaded with newcmd2
- Fixed
- Enhancements
- Improved displaying multiline CompletionErrors by indenting all lines
0.9.18 (October 1, 2019)
- Bug Fixes
- Fixed bug introduced in 0.9.17 where help functions for hidden and disabled commands were not being filtered out as help topics
- Enhancements
AutoCompleter
now handles argparse's mutually exclusive groups. It will not tab complete flag names or positionals for already completed groups. It also will print an error if you try tab completing a flag's value if the flag belongs to a completed group.AutoCompleter
now uses the passed-in parser's help formatter to generate hint text. This gives help and hint text for an argument consistent formatting.
0.9.17 (September 23, 2019)
- Bug Fixes
- Fixed a bug when using WSL when all Windows paths have been removed from $PATH
- Fixed a bug when running a cmd2 application on Linux without Gtk libraries installed
- Enhancements
- No longer treating empty text scripts as an error condition
- Allow dynamically extending a
cmd2.Cmd
object instance with ado_xxx
method at runtime - Choices/Completer functions can now be passed a dictionary that maps command-line tokens to their argparse argument. This is helpful when one argument determines what is tab completed for another argument. If these functions have an argument called
arg_tokens
, then AutoCompleter will automatically pass this dictionary to them. - Added CompletionError class that can be raised during argparse-based tab completion and printed to the user
- Added the following convenience methods
Cmd.in_script()
- return whether a text script is runningCmd.in_pyscript()
- return whether a pyscript is running
0.9.16 (August 7, 2019)
- Bug Fixes
- Fixed inconsistent parsing/tab completion behavior based on the value of
allow_redirection
. This flag is only meant to be a security setting that prevents redirection of stdout and should not alter parsing logic.
- Fixed inconsistent parsing/tab completion behavior based on the value of
- Enhancements
- Raise
TypeError
if trying to set choices/completions on argparse action that accepts no arguments - Create directory for the persistent history file if it does not already exist
- Added
set_choices_function()
,set_choices_method()
,set_completer_function()
, andset_completer_method()
to support cases where this functionality needs to be added to an argparse action outside of the normalparser.add_argument()
call.
- Raise
- Breaking Changes
- Aliases and macros can no longer have the same name as a command
0.9.15 (July 24, 2019)
- Bug Fixes
- Fixed exception caused by tab completing after an invalid subcommand was entered
- Fixed bug where
history -v
was sometimes showing raw and expanded commands when they weren't different - Fixed bug where multiline commands were having leading and ending spaces stripped. This would mess up quoted strings that crossed multiple lines.
- Fixed a bug when appending to the clipboard where contents were in reverse order
- Fixed issue where run_pyscript failed if the script's filename had 2 or more consecutive spaces
- Fixed issue where completer function of disabled command would still run
- Enhancements
- Greatly simplified using argparse-based tab completion. The new interface is a complete overhaul that breaks the previous way of specifying completion and choices functions. See header of argparse_custom.py for more information.
- Enabled tab completion on multiline commands
- Renamed Commands Notice
- The following commands were renamed in the last release and have been removed in this release
load
- replaced byrun_script
_relative_load
- replaced by_relative_run_script
pyscript
- replaced byrun_pyscript
- We apologize for any inconvenience, but the new names are more self-descriptive
- Lots of end users were confused particularly about what exactly
load
should be loading
- Lots of end users were confused particularly about what exactly
- The following commands were renamed in the last release and have been removed in this release
- Breaking Changes
- Restored
cmd2.Cmd.statement_parser
to be a public attribute (no underscore)- Since it can be useful for creating post-parsing hooks
- Completely overhauled the interface for adding tab completion to argparse arguments. See enhancements for more details.
ACArgumentParser
is now calledCmd2ArgumentParser
- Moved
basic_complete
to utils.py - Made optional arguments on the following completer methods keyword-only:
delimiter_complete
,flag_based_complete
,index_based_complete
,path_complete
,shell_cmd_complete
- Renamed history option from
--output-file
to--output_file
- Renamed
matches_sort_key
todefault_sort_key
. This value determines the default sort ordering of string results like alias, command, category, macro, settable, and shortcut names. Unsorted tab-completion results also are sorted with this key. Its default value (ALPHABETICAL_SORT_KEY) performs a case-insensitive alphabetical sort, but it can be changed to a natural sort by setting the value to NATURAL_SORT_KEY. StatementParser
now expects shortcuts to be passed in as dictionary. This eliminates the step of converting the shortcuts dictionary into a tuple before creatingStatementParser
.- Renamed
Cmd.pyscript_name
toCmd.py_bridge_name
- Renamed
Cmd.pystate
toCmd.py_locals
- Renamed
PyscriptBridge
toPyBridge
- Restored