summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-19 19:39:03 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-19 19:39:03 -0400
commit0cdc9119de361e76d665c9cab71085fe40677331 (patch)
treec0a02a1aa661f52d3086efe217108d3701c9662f
parent92ab34edff5cdb4481233cbd49c80b91194570ce (diff)
downloadcmd2-git-0cdc9119de361e76d665c9cab71085fe40677331.tar.gz
Now consistently use -t flag for transcript generation for both history and load commands
-rw-r--r--CHANGELOG.md2
-rw-r--r--cmd2/cmd2.py7
-rw-r--r--docs/transcript.rst4
-rw-r--r--tests/test_transcript.py2
4 files changed, 7 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 32cebfc5..44cc8513 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,7 @@
* The `with_argparser` decorators now add the Statement object created when parsing the command line to the
`argparse.Namespace` object they pass to the `do_*` methods. It is stored in an attribute called `__statement__`.
This can be useful if a command function needs to know the command line for things like logging.
- * Added a `-r` option to the `load` command for automatically generating a transcript based on a script file
+ * Added a `-t` option to the `load` command for automatically generating a transcript based on a script file
* Potentially breaking changes
* The following commands now write to stderr instead of stdout when printing an error. This will make catching
errors easier in pyscript.
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index b24d1a48..71be85f0 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3468,8 +3468,7 @@ class Cmd(cmd.Cmd):
)
load_parser = ACArgumentParser(description=load_description)
- setattr(load_parser.add_argument('-r', '--record_transcript',
- help='record the output of the script as a transcript file'),
+ setattr(load_parser.add_argument('-t', '--transcript', help='record the output of the script as a transcript file'),
ACTION_ARG_CHOICES, ('path_complete',))
setattr(load_parser.add_argument('script_path', help="path to the script file"),
ACTION_ARG_CHOICES, ('path_complete',))
@@ -3509,8 +3508,8 @@ class Cmd(cmd.Cmd):
self.perror("Problem accessing script from '{}': {}".format(expanded_path, ex))
return
- if args.record_transcript:
- self._generate_transcript(script_commands, os.path.expanduser(args.record_transcript))
+ if args.transcript:
+ self._generate_transcript(script_commands, os.path.expanduser(args.transcript))
return
self.cmdqueue = script_commands + ['eos'] + self.cmdqueue
diff --git a/docs/transcript.rst b/docs/transcript.rst
index 91679641..c7c31fd6 100644
--- a/docs/transcript.rst
+++ b/docs/transcript.rst
@@ -34,9 +34,9 @@ This is by far the easiest way to generate a transcript.
Automatically from a script file
--------------------------------
-A transcript can also be automatically generated from a script file using ``load -r``::
+A transcript can also be automatically generated from a script file using ``load -t``::
- (Cmd) load scripts/script.txt -r transcript.txt
+ (Cmd) load scripts/script.txt -t transcript.txt
2 commands and their outputs saved to transcript file 'transcript.txt'
(Cmd)
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index 6c9b8a20..acdbe703 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -203,7 +203,7 @@ def test_load_record_transcript(base_app, request):
os.close(fd)
# Run the load command with the -r option to generate a transcript
- run_cmd(base_app, 'load {} -r {}'.format(filename, transcript_fname))
+ run_cmd(base_app, 'load {} -t {}'.format(filename, transcript_fname))
assert base_app.cmdqueue == []
assert base_app._script_dir == []