You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cmd2 now has a dependency on rich for rich text and pretty formatting in the terminal. Previously, cmd2 had a large amount of custom code for this purpose that predated the existence of rich. This opens the door to even more beautiful cmd2 applications. To get the most out of the new capabilities, we encourage you to spend a little bit of time reading the rich documentation.
Details
Breaking Changes
Refactored and modernized styling and utility modules:
Removed the legacy table_creator.py module in favor of rich tables (see the rich_tables.py example for more info)
Moved all string-related functions from utils.py to a new string_utils.py module
Consolidated all string styling functions from ansi.py into string_utils.py
Replaced all text style enums from ansi.py with modern rich styles
Renamed ansi.py to terminal_utils.py to better reflect its purpose
Dropped support for Python 3.9. cmd2 now requires Python 3.10 or later
Replaced Settable.get_value() and Settable.set_value() methods with a more Pythonic value property
Removed redundant setting of a parser's prog value in the with_argparser() decorator, as this is now handled centrally in Cmd._build_parser()
The auto_load_commands argument to cmd2.Cmd.__init__ now defaults to False
Enhancements
Enhanced all print methods (poutput(), perror(), ppaged(), etc.) to natively render rich objects, enabling beautiful and complex output
Simplified the process for setting a custom parser for cmd2's built-in commands. See the custom_parser.py example for an updated guide
Introduced Cmd.macro_arg_complete() for tab-completing macro arguments, with default path completion that can be easily customized
Added colors.py and styles.py to provide easy access to rich color names and manage cmd2-specific style definitions using StrEnum (see the colors.py example for a demonstration of all colors available to your cmd2 application)
Added ability to create a custom theme for a cmd2 application using rich_utils.set_theme (see the rich_theme.py example for more info)
Consolidated multiple redundant examples into a few more comprehensive ones, see:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
cmd2
now has a dependency on rich for rich text and prettyformatting in the terminal. Previously,
cmd2
had a large amount of custom code for this purposethat predated the existence of
rich
. This opens the door to even more beautifulcmd2
applications. To get the most out of the new capabilities, we encourage you to spend a little bit of
time reading the rich documentation.
Details
Breaking Changes
table_creator.py
module in favor ofrich
tables (see therich_tables.py
example for more info)
utils.py
to a newstring_utils.py
moduleansi.py
intostring_utils.py
ansi.py
with modernrich
stylesansi.py
toterminal_utils.py
to better reflect its purposecmd2
now requires Python 3.10 or laterSettable.get_value()
andSettable.set_value()
methods with a more Pythonicvalue
propertyprog
value in thewith_argparser()
decorator, asthis is now handled centrally in
Cmd._build_parser()
auto_load_commands
argument tocmd2.Cmd.__init__
now defaults toFalse
Enhancements
poutput()
,perror()
,ppaged()
, etc.) to natively renderrich
objects, enabling beautiful and complex outputcmd2
's built-in commands. See thecustom_parser.py
example for an updated guide
Cmd.macro_arg_complete()
for tab-completing macro arguments, with default pathcompletion that can be easily customized
colors.py
andstyles.py
to provide easy access torich
color names and managecmd2
-specific style definitions usingStrEnum
(see thecolors.py example for a
demonstration of all colors available to your
cmd2
application)cmd2
application usingrich_utils.set_theme
(see the rich_theme.py
example for more info)
stty sane
with
termios.tcsetattr
Bug Fixes
cmd2
could unintentionally overwrite an application'ssys.stdout
Migration Aids - these will help you iteratively migrate to
cmd2
3.x in stagesthe
cmd2.ansi
module present incmd2
2.7.0the
cmd2.table_creator
module present incmd2
2.7.0This discussion was created from the release 3.0.0rc1 Release Candidate (2025-09-26).
Beta Was this translation helpful? Give feedback.
All reactions