Skip to content

Commit bdbc263

Browse files
committed
Update help text and documentation for history -t argument
Clarified that this actually re-runs the select commands since the expected output from the commands isn't saved in the history along with the commands themselves.
1 parent 493a4c8 commit bdbc263

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
- Breaking Change
44
- `cmd2` 2.6 supports Python 3.9+ (removed support for Python 3.8)
55
- Enhancements
6-
- Add support for Python 3.14
6+
- Added support for Python 3.14
77
- Added new `Cmd.ppretty()` method for pretty printing arbitrary Python data structures
8+
- Clarified help text for `-t`/`--transcript` argument to the `history` command
89

910
## 2.5.11 (January 25, 2025)
1011

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4632,7 +4632,7 @@ def do_ipy(self, _: argparse.Namespace) -> Optional[bool]: # pragma: no cover
46324632
'-t',
46334633
'--transcript',
46344634
metavar='TRANSCRIPT_FILE',
4635-
help='output commands and results to a transcript file,\nimplies -s',
4635+
help='create a transcript file by re-running the commands,\nimplies both -r and -s',
46364636
completer=path_complete,
46374637
)
46384638
history_action_group.add_argument('-c', '--clear', action='store_true', help='clear all history')
@@ -4750,7 +4750,7 @@ def do_history(self, args: argparse.Namespace) -> Optional[bool]:
47504750
self.pfeedback(f"{len(history)} command{plural} saved to {full_path}")
47514751
self.last_result = True
47524752
elif args.transcript:
4753-
# self.last_resort will be set by _generate_transcript()
4753+
# self.last_result will be set by _generate_transcript()
47544754
self._generate_transcript(list(history.values()), args.transcript)
47554755
else:
47564756
# Display the history items retrieved

docs/features/history.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ The `history` command can also save both the commands and their output to a text
127127

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

130+
!!! warning
131+
132+
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.
133+
130134
The last action the history command can perform is to clear the command history using `-c` or `--clear`:
131135

132136
(Cmd) history -c

0 commit comments

Comments
 (0)