Cmd2

Latest version: v2.5.11

Safety actively analyzes 723158 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 17

2.3.1

- Bug Fixes
- Fixed issue introduced in 2.3.0 with `AlternatingTable`, `BorderedTable`, and `SimpleTable` that caused
header alignment settings to be overridden by data alignment settings.
- Enhancements
- `CompletionItems` now saves the original object from which it creates a string.
- Using `CompletionItems` as argparse choices is fully supported. `cmd2` patched `argparse` to compare input to
the original value instead of the `CompletionItems` instance.
- `ArgparseCompleter` now does the following if a list of `CompletionItems` was created with numerical types:
- Sorts completion hints numerically
- Right-aligns the left-most column in completion hint table

2.3.0

- Bug Fixes
- Fixed `AttributeError` in `rl_get_prompt()` when prompt is `None`.
- 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.
- 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 `AlternatingTable`, `BorderedTable`, and `SimpleTable`.
- Added support for 8-bit/256-colors with the `cmd2.EightBitFg` and `cmd2.EightBitBg` classes.
- Added support for 24-bit/RGB colors with the `cmd2.RgbFg` and `cmd2.RgbBg` classes.
- Removed dependency on colorama.
- Changed type of `ansi.allow_style` from a string to an `ansi.AllowStyle` Enum class.
- Deprecations
- Deprecated `cmd2.fg`. Use `cmd2.Fg` instead.
- Deprecated `cmd2.bg`. Use `cmd2.Bg` instead.
- Breaking Changes
- To support the color upgrade, all cmd2 colors now inherit from either `ansi.FgColor` or `ansi.BgColor`.
Therefore, `ansi.style()` no longer accepts colors as strings.

2.2.0

- 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 of `ArgparseCompleter`.
- Added `ArgumentParser.get_ap_completer_type()` and `ArgumentParser.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 to `Cmd2ArgumentParser.__init__()` which saves a call
to `set_ap_completer_type()`. This keyword will also work with `add_parser()` when creating subcommands
if the base command's parser is a `Cmd2ArgumentParser`.
- New function `register_argparse_argument_parameter()` allows developers to specify custom
parameters to be passed to the argparse parser's `add_argument()` method. These parameters will
become accessible in the resulting argparse Action object when modifying `ArgparseCompleter` 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 of `Cmd.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 for `self.prompt` not matching Readline's current prompt.
- Deletions (potentially breaking changes)
- Deleted `set_choices_provider()` and `set_completer()` which were deprecated in 2.1.2
- Breaking Changes
- Renamed `set_default_argument_parser()` to `set_default_argument_parser_type()`

2.1.2

- Enhancements
- Added the following accessor methods for cmd2-specific attributes to the `argparse.Action` class
- `get_choices_callable()`
- `set_choices_provider()`
- `set_completer()`
- `get_descriptive_header()`
- `set_descriptive_header()`
- `get_nargs_range()`
- `set_nargs_range()`
- `get_suppress_tab_hint()`
- `set_suppress_tab_hint()`
- Deprecations
- Now that `set_choices_provider()` and `set_completer()` have been added as methods to the
`argparse.Action` class, the standalone functions of the same name will be removed in version
2.2.0. To update to the new convention, do the following:
- Change `set_choices_provider(action, provider)` to `action.set_choices_provider(provider)`
- Change `set_completer(action, completer)` to `action.set_completer(completer)`

2.1.1

- Bug Fixes
- Fixed handling of argparse's default options group name which was changed in Python 3.10
- Enhancements
- Restored `plugins` and `tests_isolated` directories to tarball published to PyPI for `cmd2` release

2.1.0

- Enhancements
- Converted persistent history files from pickle to compressed JSON

Page 4 of 17

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.