Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## 2.6.0 (May TBD, 2025)
## 2.6.0 (May 31, 2025)

- Breaking Change
- `cmd2` 2.6 supports Python 3.9+ (removed support for Python 3.8)
- Enhancements
- Add support for Python 3.14
- Added support for Python 3.14
- Added new `Cmd.ppretty()` method for pretty printing arbitrary Python data structures
- Clarified help text for `-t`/`--transcript` argument to the `history` command

## 2.5.11 (January 25, 2025)

Expand Down
4 changes: 2 additions & 2 deletions cmd2/cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4632,7 +4632,7 @@ def do_ipy(self, _: argparse.Namespace) -> Optional[bool]: # pragma: no cover
'-t',
'--transcript',
metavar='TRANSCRIPT_FILE',
help='output commands and results to a transcript file,\nimplies -s',
help='create a transcript file by re-running the commands,\nimplies both -r and -s',
completer=path_complete,
)
history_action_group.add_argument('-c', '--clear', action='store_true', help='clear all history')
Expand Down Expand Up @@ -4750,7 +4750,7 @@ def do_history(self, args: argparse.Namespace) -> Optional[bool]:
self.pfeedback(f"{len(history)} command{plural} saved to {full_path}")
self.last_result = True
elif args.transcript:
# self.last_resort will be set by _generate_transcript()
# self.last_result will be set by _generate_transcript()
self._generate_transcript(list(history.values()), args.transcript)
else:
# Display the history items retrieved
Expand Down
4 changes: 4 additions & 0 deletions docs/features/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ The `history` command can also save both the commands and their output to a text

The `--transcript` option implies `--run`: the commands must be re-run in order to capture their output to the transcript file.

!!! warning

Unlike the `-o`/`--output-file` option, the `-t`/`--transcript` option will actually run the selected history commands again. This is necessary for creating a transcript file since the history saves the commands themselves but does not save their output. Please note that a side-effect of this is that the commands will appear again at the end of the history.

The last action the history command can perform is to clear the command history using `-c` or `--clear`:

(Cmd) history -c
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def verify_help_text(
-o, --output_file FILE
output commands to a script file, implies -s
-t, --transcript TRANSCRIPT_FILE
output commands and results to a transcript file,
implies -s
create a transcript file by re-running the commands,
implies both -r and -s
-c, --clear clear all history
formatting:
Expand Down
Loading