Skip to content

Commit 0cdc911

Browse files
committed
Now consistently use -t flag for transcript generation for both history and load commands
1 parent 92ab34e commit 0cdc911

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* The `with_argparser` decorators now add the Statement object created when parsing the command line to the
1010
`argparse.Namespace` object they pass to the `do_*` methods. It is stored in an attribute called `__statement__`.
1111
This can be useful if a command function needs to know the command line for things like logging.
12-
* Added a `-r` option to the `load` command for automatically generating a transcript based on a script file
12+
* Added a `-t` option to the `load` command for automatically generating a transcript based on a script file
1313
* Potentially breaking changes
1414
* The following commands now write to stderr instead of stdout when printing an error. This will make catching
1515
errors easier in pyscript.

cmd2/cmd2.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,8 +3468,7 @@ def do_eos(self, _: argparse.Namespace) -> None:
34683468
)
34693469

34703470
load_parser = ACArgumentParser(description=load_description)
3471-
setattr(load_parser.add_argument('-r', '--record_transcript',
3472-
help='record the output of the script as a transcript file'),
3471+
setattr(load_parser.add_argument('-t', '--transcript', help='record the output of the script as a transcript file'),
34733472
ACTION_ARG_CHOICES, ('path_complete',))
34743473
setattr(load_parser.add_argument('script_path', help="path to the script file"),
34753474
ACTION_ARG_CHOICES, ('path_complete',))
@@ -3509,8 +3508,8 @@ def do_load(self, args: argparse.Namespace) -> None:
35093508
self.perror("Problem accessing script from '{}': {}".format(expanded_path, ex))
35103509
return
35113510

3512-
if args.record_transcript:
3513-
self._generate_transcript(script_commands, os.path.expanduser(args.record_transcript))
3511+
if args.transcript:
3512+
self._generate_transcript(script_commands, os.path.expanduser(args.transcript))
35143513
return
35153514

35163515
self.cmdqueue = script_commands + ['eos'] + self.cmdqueue

docs/transcript.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ This is by far the easiest way to generate a transcript.
3434

3535
Automatically from a script file
3636
--------------------------------
37-
A transcript can also be automatically generated from a script file using ``load -r``::
37+
A transcript can also be automatically generated from a script file using ``load -t``::
3838

39-
(Cmd) load scripts/script.txt -r transcript.txt
39+
(Cmd) load scripts/script.txt -t transcript.txt
4040
2 commands and their outputs saved to transcript file 'transcript.txt'
4141
(Cmd)
4242

tests/test_transcript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def test_load_record_transcript(base_app, request):
203203
os.close(fd)
204204

205205
# Run the load command with the -r option to generate a transcript
206-
run_cmd(base_app, 'load {} -r {}'.format(filename, transcript_fname))
206+
run_cmd(base_app, 'load {} -t {}'.format(filename, transcript_fname))
207207

208208
assert base_app.cmdqueue == []
209209
assert base_app._script_dir == []

0 commit comments

Comments
 (0)