4.0.0b1 (2026-03-03) #1599
tleonhardt
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
cmd2now has a dependency onprompt-toolkit which serves as a
pure-Python cross-platform replacement for
GNU Readline. Previously,
cmd2had useddifferent
readlinedependencies on each Operating System (OS) which was at times a veryfrustrating developer and user experience due to small inconsistencies in these different readline
libraries. Now we have consistent cross-platform support for tab-completion, user terminal input,
and history. Additionally, this opens up some cool advanced features such as support for syntax
highlighting of user input while typing, auto-suggestions similar to those provided by the fish
shell, and the option for a persistent bottom bar that can display realtime status updates while the
prompt is displayed.
Details
readlinebuilt-in module and underlying platform librariescmd2.rl_utilsmodule which dealt with importing the properreadlinemodule foreach platform and provided utility functions related to
readlineprompt-toolkitand a newcmd2.pt_utilsmodule with supportingutilities
history -toption for generatingtranscript files and the
cmd2.transcriptmodulebuilt into cmd2
Robot Framework for acceptance tests. Both of these
frameworks can be used to create tests which are far more reliable and less brittle.
prompt-toolkitstarts its ownasyncioevent loop in everycmd2application
cmd2.Cmd.terminal_lockas it is no longer required to support things likecmd2.Cmd.async_alertcmd2.Cmd.async_refresh_promptandcmd2.Cmd.need_prompt_refreshas they are nolonger needed
completerfunctions must now return acmd2.Completionsobject instead oflist[str].choices_providerfunctions must now return acmd2.Choicesobject instead oflist[str].descriptive_headersfield is now calledtable_header.CompletionItem.descriptive_datais now calledCompletionItem.table_row.Cmd.default_sort_keymoved toutils.DEFAULT_STR_SORT_KEY.Cmd, into other classes.Cmd.matches_sorted->Completions.is_sortedandChoices.is_sortedCmd.completion_hint->Completions.completion_hintCmd.formatted_completions->Completions.completion_tableCmd.allow_appended_space/allow_closing_quote->Completions.allow_finalizationCmd.matches_delimitedsince it's no longer used.flag_based_completeandindex_based_completefunctions since their functionalityis already provided in arpgarse-based completion.
Statement.multiline_commandfrom a string to a bool.Statement.arg_lista property which generates the list on-demand.Statement.outputtoStatement.redirector.Statement.output_totoStatement.redirect_to.Statement.pipe_tosince it can be handled byStatement.redirectorandStatement.redirect_to.StatementParser.parse_command_only()to return aPartialStatementobject.Macro.arg_listtoMacro.args.terminal_utils.pysinceprompt-toolkitprovides this functionality.async_alert()andasync_update_prompt()with a single function calledadd_alert(). This new function is thread-safe and does not require you to acquire a mutexbefore calling it like the previous functions did.
Cmd.default_to_shell.cmd2.CmdparametersTrue, provide fish shell style auto-suggestions. Theseare grayed-out hints based on history. User can press right-arrow key to accept the
provided suggestion.
True, present a persistent bottom toolbar capable ofdisplaying realtime status information while the prompt is displayed, see the
cmd2.Cmd2.get_bottom_toolbarmethod that can be overridden as well as the updatedgetting_started.pyexamplecmd2.Cmdmethodsbottom_toolbarisTrueprompt-toolkitevent loop has starteddisplay in a single column
This discussion was created from the release 4.0.0b1 (2026-03-03).
Beta Was this translation helpful? Give feedback.
All reactions