Cmd2

Latest version: v2.5.11

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

Scan your dependencies

Page 6 of 17

1.3.9

- Breaking Changes
- `CommandSet.on_unregister()` is now called as first step in unregistering a `CommandSet` and not
the last. `CommandSet.on_unregistered()` is now the last step.
- Enhancements
- Added `CommandSet.on_registered()`. This is called by `cmd2.Cmd` after a `CommandSet` is registered
and all its commands have been added to the CLI.
- Added `CommandSet.on_unregistered()`. This is called by `cmd2.Cmd` after a `CommandSet` is unregistered
and all its commands have been removed from the CLI.

1.3.8

- Bug Fixes
- Fixed issue where subcommand added with `as_subcommand_to` decorator did not display help
when called with `-h/--help`.
- Enhancements
- `add_help=False` no longer has to be passed to parsers used in `as_subcommand_to` decorator.
Only pass this if your subcommand should not have the `-h/--help` help option (as stated in
argparse documentation).

1.3.7

- Bug Fixes
- Fixes an issue introduced in 1.3.0 with processing command strings containing terminator/separator
character(s) that are manually passed to a command that uses argparse.

1.3.6

- Breaking changes
- The functions cmd2 adds to Namespaces (`get_statement()` and `get_handler()`) are now
`Cmd2AttributeWrapper` objects named `cmd2_statement` and `cmd2_handler`. This makes it
easy to filter out which attributes in an `argparse.Namespace` were added by `cmd2`.
- Deprecations
- `Namespace.__statement__` will be removed in `cmd2` 2.0.0. Use `Namespace.cmd2_statement.get()`
going forward.

1.3.5

- Bug Fixes
- Fixed `RecursionError` when printing an `argparse.Namespace` caused by custom attribute cmd2 was adding
- Enhancements
- Added `get_statement()` function to `argparse.Namespace` which returns `__statement__` attribute

1.3.4

- Bug Fixes
- Fixed `AttributeError` when `CommandSet` that uses `as_subcommand_to` decorator is loaded during
`cmd2.Cmd.__init__()`.
- Enhancements
- Improved exception messages when using mock without `spec=True`.
See [testing](https://cmd2.readthedocs.io/en/latest/testing.html) documentation for more details on testing
cmd2-based applications with mock.

Page 6 of 17

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.