Repository navigation
Releases
Releases · python-cmd2/cmd2
4.4.4 (2026-11-30)
What's Changed
- Bug Fixes
- Tab completion of a match which needs quotes, such as a file name with a space, now takes one press of Tab instead of two. The opening quote is inserted and the completion carries on in the same key press.
- A match chosen from the completion menu now closes its quote and adds a trailing space. Previously the quote was left open, and running the command failed with
Invalid syntax: No closing quotation. A directory still leaves its quote open so the rest of the path can be completed. See the Quotes Added by Completion documentation for details.Completions.allow_finalizationused to be ignored when there were several matches. It now decides whether a match chosen from them closes its quote. If you have written a completer which offers matches the user keeps completing, like directories, alongside other matches, returnallow_finalization=Falsefor those results so the quote stays open.
- On Windows, paths typed with forward slashes now complete properly. Shell command completion treats text such as
./myandC:/tools/myas a path instead of searchingPATHfor a command of that name. Path completion keeps the separators as they were typed, so the first Tab extends the part which several matching names share. history --output-fileandhistory --editnow write their files as UTF-8, which is whatrun_scriptreads. On a locale whose encoding is not UTF-8, such as Korean or Japanese Windows, a history with non-ASCII text was written in the locale's encoding.run_scriptthen rejected the saved file as not being ASCII or UTF-8 text, andhistory --editdid not run the edited commands.run_scriptnow skips a UTF-8 byte order mark at the start of a script file, which some Windows editors and Windows PowerShell 5.1 write. Previously the mark became part of the first command, so that command was not recognized.run_pyscriptnow reads a script the way Python does, instead of in the locale's encoding. It honors a byte order mark or a PEP 263 coding declaration, and otherwise reads the script as UTF-8. On a locale whose encoding is not UTF-8, a UTF-8 script with non-ASCII text used to fail withUnicodeDecodeErroror run with garbled strings. A script which cannot be decoded is now reported as an error reading the script file.- A script saved in another encoding, such as the locale's, now needs a coding declaration like
# -*- coding: cp949 -*-, as it does when Python runs it.
- A script saved in another encoding, such as the locale's, now needs a coding declaration like
- A window title set from another thread with
set_window_title()no longer interleaves with the drawing of a prompt-toolkit application which a command runs itself, such asprompt_toolkit.prompt()or the prompt of theipycommand. The title is now written on that application's event loop, as it already was forcmd2's own prompts. This applies when the application shares this app's terminal output and runs in theAppSessionwhich was current when theCmdwas created. - The
save_help_text.pyexample script now writes its output file as UTF-8. On a locale whose encoding is not UTF-8, it could fail withUnicodeEncodeErroron a character in the help text which that encoding lacks.
New Contributors
- @sogav21 made their first contribution in #1825
- @timothyanderson096-ocdealcheck made their first contribution in #1830
- @mrbuho-O made their first contribution in #1837
- @Alpenj made their first contribution in #1836
Full Changelog: 4.4.3...4.4.4
4.4.3 (2026-11-16)
What's Changed
- Bug Fixes
ppaged()now prints its output when the configured pager program cannot be run, for example wherelessis not installed. Previously only the shell's error was shown and the output was lost. A pager command which could not be run is not tried again while the application is running, so the shell's error is shown once for each pager command instead of every time.- A command which prints through a
cmd2console of its own, such as aCmd2GeneralConsoleshowing a Rich progress bar, no longer ends with aBrokenPipeErrormessage when its output is piped to something that exits early, asheaddoes.cmd2now ends the command quietly instead, printingbroken_pipe_warningif it is set.cmd2consoles now raiseConsoleBrokenPipeError, a new subclass ofBrokenPipeErrorwhosefileattribute is the stream which broke. - Fixed tab completion of file paths and shell commands, and
get_exes_in_path(), for names containing square brackets. This includes a working directory, home directory, orPATHdirectory with brackets in its name. - File path completion, shell command completion, and
get_exes_in_path()now match*and?literally instead of returning nothing when the text being completed contains one, so names containing those characters can be completed. - Tab completion now quotes a match which has a character that is special to a shell, such as
*,?,(,&, or$, when the text being completed is passed to a shell: the arguments of theshellcommand and everything after a pipe. This keeps the shell from expanding or misreading the completed name. Everywhere else, only a match with a space is quoted, as before. See the Special Characters in Paths documentation for details. get_exes_in_path(),find_editor(), and shell command completion no longer skipPATHentries which are symbolic links to directories.find_editor()now finds theediteditor on Windows. It was the preferred default editor there but could never be found because it was searched for without its.exeextension, so the default editor on a Windows machine which haseditchanges to it.
- Enhancements
- Added the rich_progress.py example, which shows how to display the progress of long-running commands with Rich status spinners and progress bars. See the new Updating Output in Place documentation for details, including why a carriage return embedded in a string passed to
poutput()does not move the cursor. - Added the textual_tty_toolbar.py example, which shows how to keep a bottom toolbar on the screen while commands run by running a
cmd2application inside a Textual application which draws the toolbar. See Embedding in Textual for how it works and what it costs.
- Added the rich_progress.py example, which shows how to display the progress of long-running commands with Rich status spinners and progress bars. See the new Updating Output in Place documentation for details, including why a carriage return embedded in a string passed to
New Contributors
- @anticipate218 made their first contribution in #1811
Full Changelog: 4.4.2...4.4.3
4.4.2 (November 11, 2026)
What's Changed
- Security
- Fixed shell command injection through file names in the
editcommand andCmd.run_editor().
A file name containing shell syntax such as$(...)or backticks was interpreted by the shell
instead of being passed to the editor as-is. On Windows,run_editor()now raises
ValueErrorfor an editor or file path containing a double quote, which cannot be passed
safely tocmd.exe. - The persistent history file is now readable and writable only by its owner (mode
0600on
POSIX), since history can contain secrets typed as command arguments. The permissions of an
existing history file are tightened the next time history is saved.
- Fixed shell command injection through file names in the
4.4.1 (November 2, 2026)
Overview
There are no functional changes from the 4.4.0 release. The main point is to begin publishing full provenance data to PyPI with each release as an added security feature.
What's Changed
- Size the relay test's payload from the pipe capacity by @setarcos in #1801
- Publish releases from GitHub Actions with PyPI provenance by @tleonhardt in #1802
New Contributors
Full Changelog: 4.4.0...4.4.1
4.4.0 (October 31, 2026) 🎃
Overview
This release mostly fixes some edge cases in the build-in history command.
What's Changed
- Bump github/codeql-action from 4.39.0 to 4.39.1 by @dependabot[bot] in #1786
- Fix history ranges starting past the end by @AryanRG in #1778
- Fix History.truncate() leaving session start index stale by @tleonhardt in #1787
- Flush window title updates without waiting for a prompt by @tleonhardt in #1790
- Fix two races behind the flaky pipeline job-control test by @tleonhardt in #1794
- Add security policy naming the Security Maintainer by @tleonhardt in #1797
- Preserve history session boundaries across list mutations by @mayankdhingra02 in #1795
- Track history session membership by entry instead of index by @tleonhardt in #1798
- Preserve live history while persisting a bounded copy by @ungaaaabungaaa in #1796
- Address review feedback on persisted history copy by @tleonhardt in #1799
New Contributors
- @mayankdhingra02 made their first contribution in #1795
- @ungaaaabungaaa made their first contribution in #1796
Full Changelog: 4.3.1...4.4.0
4.3.1 (October 24, 2026)
What's Changed
- Bump github/codeql-action from 4.38.2 to 4.38.3 by @dependabot[bot] in #1772
- Fix type-check failures with ty 0.0.87 by @DG-Elom in #1774
- Exclude .DS_Store from release by @traylenator in #1775
- Route annotated command help through the application output stream by @AryanRG in #1779
- Bump github/codeql-action from 4.38.3 to 4.39.0 by @dependabot[bot] in #1780
- Add example embedding a cmd2 app in a Textual app with textual-tty by @DG-Elom in #1773
- Add example embedding a cmd2 app in a Textual app with textual-tty by @tleonhardt in #1781
New Contributors
- @DG-Elom made their first contribution in #1774
- @traylenator made their first contribution in #1775
- @AryanRG made their first contribution in #1779
Full Changelog: 4.3.0...4.3.1
4.3.0 (October 13, 2026)
Overview
This release primarily fixes a number of subtle bugs related to piping cmd2 command output to shell commands. It also removes the experimental tag from the @with_annotated decorator feature.
Details
- Stabilized features
@with_annotatedis no longer experimental. It was introduced as an experimental feature in
4.0.0 and is now a fully supported way to define a command's arguments, alongside
@with_argparser. This covers the decorator and its supporting API incmd2.annotated,
includingArgument,Option,Group, andArgumentBlock.
Annotated Argument Processing.
- Bug Fixes
- On POSIX, piping a command's output to an interactive program such as
less
(help -v | less) now runs that program as the terminal's foreground job, as a shell pipeline
does. It had run in a separate session that never received the terminal, so Ctrl-Z andfg
did not suspend and resume it together with cmd2. The program now owns the terminal as it
starts, so a pager can set its terminal modes, and Ctrl-C and Ctrl-Z reach the whole pipeline.
Pipes started from a worker thread, or whose output does not go to the terminal, such as one
nested in a command whose own output is piped, still run in their own session - A
shellcommand piped to an interactive program, such asshell git log | less, now joins
the pipeline's job, so both processes receive Ctrl-C and Ctrl-Z - On Windows, fixed piped output appearing garbled in console programs such as
more
(help -v | more), a regression in 4.2.4. Pipes are written as UTF-8, but console programs
decode their input with the console's code page. While a pipe or the pager runs, cmd2 now sets
the console to UTF-8 (code page 65001, aschcp 65001does) and restores its code pages
afterward, so console programs and UTF-8 tools such asrgboth read the output correctly - When copying a command's output to the clipboard (
help >) fails, later commands' output is
no longer written to the temporary file that held it - When a pipe's process cannot be started, for instance because no more processes can be created
or$SHELLnames a program that cannot run, both ends of the pipe are now closed rather than
left open - When a pipe's process exits before the command runs, what it wrote, such as the shell's
"command not found", is no longer lost when cmd2 captures the output, as in a pyscript
- On POSIX, piping a command's output to an interactive program such as
4.2.4 (September 8, 2026)
What's Changed
- uv run does its own sync of the project env with default groups by @tleonhardt in #1746
- Add aggregation jobs to maxtrix workflows by @tleonhardt in #1747
- Keep the right prompt out of the committed prompt frame by @tleonhardt in #1749
- Write redirected and piped output as UTF-8, and stop the suite inheriting colour settings by @tleonhardt in #1753
- Fix ty errors present in version 0.0.79 which came out yesterday by @tleonhardt in #1754
Full Changelog: 4.2.3...4.2.4
4.2.3 (September 2, 2026)
What's Changed
- Fix ty unresolved-attribute warnings and add mypy back by @tleonhardt in #1737
- Update ruff to version 0.16.5 by @tleonhardt in #1738
- Bump github/codeql-action from 4.37.8 to 4.37.9 by @dependabot[bot] in #1740
- Update readme by @tleonhardt in #1739
Full Changelog: 4.2.2...4.2.3
4.2.2 (August 25, 2026)
- Documentation Improvements
- Improved documentation in attempt at making some recommended best-practices more discoverable
- Fixed the broken
cmd_as_argumentexample