Releases: python-cmd2/cmd2
Releases · python-cmd2/cmd2
2.5.0 (October 23, 2024)
- Breaking Change
cmd2
2.5 supports Python 3.8+ (removed support for Python 3.6 and 3.7)
- Bug Fixes
- Fixed issue where persistent history file was not saved upon SIGHUP and SIGTERM signals.
- Multiline commands are no longer fragmented in up-arrow history.
- Fixed bug where
async_alert()
overwrites readline's incremental and non-incremental search prompts.- This fix introduces behavior where an updated prompt won't display after an aborted search
until a user presses Enter. See async_printing.py
example for how to handle this case usingCmd.need_prompt_refresh()
andCmd.async_refresh_prompt()
.
- This fix introduces behavior where an updated prompt won't display after an aborted search
- Enhancements
- Removed dependency on
attrs
and replaced with dataclasses - add
allow_clipboard
initialization parameter and attribute to disable ability to
add output to the operating system clipboard - Updated unit tests to be Python 3.13 compliant.
- Fall back to bz2 compression of history file when lzma is not installed.
- Added settable called
scripts_add_to_history
which determines whether scripts and pyscripts
add commands to history.
- Removed dependency on
- Deletions (potentially breaking changes)
- Removed
apply_style
fromCmd.pwarning()
.
- Removed
2.4.3 (January 27, 2023)
- Bug Fixes
- Fixed ValueError caused when passing
Cmd.columnize()
strings wider thandisplay_width
.
- Fixed ValueError caused when passing
- Enhancements
- Renamed
utils.str_to_bool()
->utils.to_bool()
. - Enhanced
utils.to_bool()
so that it accepts and convertsbool
,int
, andfloat
in addition tostr
.
- Renamed
2.4.2 (July 13, 2022)
- Enhancements
- Updated argparse decorator to remove annotations when the docstring is used for a command's help text.
- Updated unit test to be Python 3.11 compliant.
2.4.1 (April 13, 2022)
- Bug Fixes
- Fixed value for
ansi.Bg.YELLOW
. - Fixed unit tests for
ansi.allow_style
.
- Fixed value for
- Enhancements
async_alert()
raises aRuntimeError
if called from the main thread.
2.4.0 (February 22, 2022)
- Bug Fixes
- Fixed issue in
ansi.async_alert_str()
which would raiseIndexError
if prompt was blank. - Fixed issue where tab completion was quoting argparse flags in some cases.
- Fixed issue in
- Enhancements
- Added broader exception handling when enabling clipboard functionality via
pyperclip
. - Added
PassThroughException
to__init__.py
imports. - cmd2 now uses pyreadline3 when running any version of Python on Windows
- Improved memory usage in certain use cases of tables (e.g. nested colored tables)
- Added broader exception handling when enabling clipboard functionality via
- Deletions (potentially breaking changes)
- Deleted
cmd2.fg
andcmd2.bg
which were deprecated in 2.3.0. Usecmd2.Fg
andcmd2.Bg
instead.
- Deleted
2.3.3 (November 29, 2021)
- Enhancements
- Added clearer exception handling to
BorderedTable
andSimpleTable
.
- Added clearer exception handling to
2.3.2 (November 22, 2021)
- Bug Fixes
- Fixed issue where a
ns_provider
could be passedNone
instead of its correctcmd2.Cmd
orCommandSet
value.
- Fixed issue where a
2.3.1 (November 18, 2021)
- Bug Fixes
- Fixed issue introduced in 2.3.0 with
AlternatingTable
,BorderedTable
, andSimpleTable
that caused
header alignment settings to be overridden by data alignment settings.
- Fixed issue introduced in 2.3.0 with
- Enhancements
CompletionItems
now saves the original object from which it creates a string.- Using
CompletionItems
as argparse choices is fully supported.cmd2
patchedargparse
to compare input to
the original value instead of theCompletionItems
instance. ArgparseCompleter
now does the following if a list ofCompletionItems
was created with numerical types:- Sorts completion hints numerically
- Right-aligns the left-most column in completion hint table
2.3.0 (November 11, 2021)
- Bug Fixes
- Fixed
AttributeError
inrl_get_prompt()
when prompt isNone
. - Fixed bug where using choices on a Settable didn't verify that a valid choice had been entered.
- Fixed bug introduced in cmd2 2.0.0 in which
select()
converts return values to strings. It should never
have converted return values.
- Fixed
- Enhancements
- Added settings to Column class which prevent a table from overriding existing styles in header
and/or data text. This allows for things like nesting an AlternatingTable in another AlternatingTable. - AlternatingTable no longer automatically applies background color to borders. This was done to improve
appearance since the background color extended beyond the borders of the table. - Added ability to colorize all aspects of
AlternatingTables
,BorderedTables
, andSimpleTables
. - Added support for 8-bit/256-colors with the
cmd2.EightBitFg
andcmd2.EightBitBg
classes. - Added support for 24-bit/RGB colors with the
cmd2.RgbFg
andcmd2.RgbBg
classes. - Removed dependency on colorama.
- Changed type of
ansi.allow_style
from a string to anansi.AllowStyle
Enum class.
- Added settings to Column class which prevent a table from overriding existing styles in header
- Deprecations
- Deprecated
cmd2.fg
. Usecmd2.Fg
instead. - Deprecated
cmd2.bg
. Usecmd2.Bg
instead.
- Deprecated
- Breaking Changes
- To support the color upgrade, all cmd2 colors now inherit from either
ansi.FgColor
oransi.BgColor
.
Therefore,ansi.style()
no longer accepts colors as strings.
- To support the color upgrade, all cmd2 colors now inherit from either
2.2.0 (September 14, 2021)
- Bug Fixes
- Fixed extra space appended to each alias by "alias list" command
- Enhancements
- New function
set_default_ap_completer_type()
allows developer to extend and modify the
behavior ofArgparseCompleter
. - Added
ArgumentParser.get_ap_completer_type()
andArgumentParser.set_ap_completer_type()
. These
methods allow developers to enable custom tab completion behavior for a given parser by using a custom
ArgparseCompleter
-based class. - Added
ap_completer_type
keyword arg toCmd2ArgumentParser.__init__()
which saves a call
toset_ap_completer_type()
. This keyword will also work withadd_parser()
when creating subcommands
if the base command's parser is aCmd2ArgumentParser
. - New function
register_argparse_argument_parameter()
allows developers to specify custom
parameters to be passed to the argparse parser'sadd_argument()
method. These parameters will
become accessible in the resulting argparse Action object when modifyingArgparseCompleter
behavior. - Using
SimpleTable
in the output for the following commands to improve appearance.- help
- set (command and tab completion of Settables)
- alias tab completion
- macro tab completion
- Tab completion of
CompletionItems
now includes divider row comprised ofCmd.ruler
character. - Removed
--verbose
flag from set command since descriptions always show now. - All cmd2 built-in commands now populate
self.last_result
. - Argparse tab completer will complete remaining flag names if there are no more positionals to complete.
- Updated
async_alert()
to account forself.prompt
not matching Readline's current prompt.
- New function
- Deletions (potentially breaking changes)
- Deleted
set_choices_provider()
andset_completer()
which were deprecated in 2.1.2
- Deleted
- Breaking Changes
- Renamed
set_default_argument_parser()
toset_default_argument_parser_type()
- Renamed