4.0.0-b6 (2026-04-29)
Pre-release
Pre-release
What's Changed
- Quick fixes 4.x by @kmvanbrunt in #1651
- Remove always_show_hint settable by @tleonhardt in #1652
- Overhauled redirection and output capturing by @kmvanbrunt in #1654
- Fixed default value for traceback_show_locals. by @kmvanbrunt in #1655
- Breaking Changes
- Removed
always_show_hintsettable as it provided a poor user experience with
prompt-toolkit cmd2redirection only captures output directed toself.stdout(e.g., via
self.poutput()). Standardprint()calls write directly tosys.stdoutand are not
captured. However,print()calls withinpyscriptsand the interactive Python shell are
treated as command output and sent toself.stdout, allowing them to be captured.- Verbose help table descriptions are no longer generated from help function output. The system
now relies exclusively on command function docstrings.
- Removed
- Enhancements
- Added
HelpFormatterRenderableprotocol andHelpContenttype alias to support context-aware
help content inargparse. - The
print()function available in apyscriptwrites toself.stdoutand respects the
allow_stylesetting. It also supports printingRichobjects. - Added
Cmd2ArgumentParser.output_to()context manager to temporarily set the output stream
duringargparseoperations. This is helpful for directing output for functions like
parse_args(), which default tosys.stdoutand lack afileargument.
- Added
- Bug Fixes
- Fixed
ArgparseCompleter.print_help()not passing file stream to recursive call. - Fixed issue where
constants.REDIRECTION_TOKENSwas being mutated.
- Fixed
Full Changelog: 4.0.0-b5...4.0.0-b6