summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-16 12:55:28 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-07-16 12:55:28 -0400
commit905dbd657d481e6aaaa035cecc794bc96711f603 (patch)
tree218c407bc7170f3d92e3f20906cf5959d5b5ec81
parenteb882b2b308bb2e09761a74007ea308b489c2d56 (diff)
downloadcmd2-git-905dbd657d481e6aaaa035cecc794bc96711f603.tar.gz
Fixed documentation for run_script and renamed history option
-rw-r--r--CHANGELOG.md1
-rw-r--r--cmd2/cmd2.py11
-rw-r--r--docs/features/history.rst4
-rw-r--r--tests/conftest.py8
4 files changed, 13 insertions, 11 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 14aff012..2e3a64c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,7 @@
* Moved `basic_complete` to utils.py
* Made optional arguments on the following completer methods keyword-only:
`delimiter_complete`, `flag_based_complete`, `index_based_complete`. `path_complete`, `shell_cmd_complete`
+ * Renamed history option from `--output-file` to `--output_file`
## 0.9.14 (June 29, 2019)
* Enhancements
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index a4036a8e..f094a9d7 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -3275,11 +3275,11 @@ class Cmd(cmd.Cmd):
history_action_group.add_argument('-r', '--run', action='store_true', help='run selected history items')
history_action_group.add_argument('-e', '--edit', action='store_true',
help='edit and then run selected history items')
- history_action_group.add_argument('-o', '--output-file', metavar='FILE',
+ history_action_group.add_argument('-o', '--output_file', metavar='FILE',
help='output commands to a script file, implies -s',
completer_method=path_complete)
- history_action_group.add_argument('-t', '--transcript', help='output commands and results to a transcript file,\n'
- 'implies -s',
+ history_action_group.add_argument('-t', '--transcript', metavar='TRANSCRIPT_FILE',
+ help='output commands and results to a transcript file,\nimplies -s',
completer_method=path_complete)
history_action_group.add_argument('-c', '--clear', action='store_true', help='clear all history')
@@ -3598,11 +3598,12 @@ class Cmd(cmd.Cmd):
"Script should contain one command per line, just like the command would be\n"
"typed in the console.\n"
"\n"
- "If the -r/--record_transcript flag is used, this command instead records\n"
+ "If the -t/--transcript flag is used, this command instead records\n"
"the output of the script commands to a transcript for testing purposes.\n")
run_script_parser = ArgParser(description=run_script_description)
- run_script_parser.add_argument('-t', '--transcript', help='record the output of the script as a transcript file',
+ run_script_parser.add_argument('-t', '--transcript', metavar='TRANSCRIPT_FILE',
+ help='record the output of the script as a transcript file',
completer_method=path_complete)
run_script_parser.add_argument('script_path', help="path to the script file", completer_method=path_complete)
diff --git a/docs/features/history.rst b/docs/features/history.rst
index 7d6a03a4..1a163c80 100644
--- a/docs/features/history.rst
+++ b/docs/features/history.rst
@@ -160,7 +160,7 @@ would::
(Cmd) history --edit 2:4
If you want to save the commands to a text file, but not edit and re-run them,
-use the ``-o`` or ``--output-file`` option. This is a great way to create
+use the ``-o`` or ``--output_file`` option. This is a great way to create
:ref:`scripts`, which can be executed using the ``run_script`` command. To
save the first 5 commands entered in this session to a text file::
@@ -190,7 +190,7 @@ reference to identify previously entered commands. However, when creating a
script or a transcript, the command numbers would prevent the script from
loading properly. The ``-s`` or ``--script`` option instructs the ``history``
command to suppress the line numbers. This option is automatically set by the
-``--output-file``, ``--transcript``, and ``--edit`` options. If you want to
+``--output_file``, ``--transcript``, and ``--edit`` options. If you want to
output the history commands with line numbers to a file, you can do it with
output redirection::
diff --git a/tests/conftest.py b/tests/conftest.py
index c0aea4a6..e09e07b1 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -44,8 +44,8 @@ def verify_help_text(cmd2_app: cmd2.Cmd, help_output: Union[str, List[str]]) ->
# Help text for the history command
-HELP_HISTORY = """Usage: history [-h] [-r | -e | -o FILE | -t TRANSCRIPT | -c] [-s] [-x] [-v]
- [-a]
+HELP_HISTORY = """Usage: history [-h] [-r | -e | -o FILE | -t TRANSCRIPT_FILE | -c] [-s] [-x]
+ [-v] [-a]
[arg]
View, run, edit, save, or clear previously entered commands
@@ -61,9 +61,9 @@ optional arguments:
-h, --help show this help message and exit
-r, --run run selected history items
-e, --edit edit and then run selected history items
- -o, --output-file FILE
+ -o, --output_file FILE
output commands to a script file, implies -s
- -t, --transcript TRANSCRIPT
+ -t, --transcript TRANSCRIPT_FILE
output commands and results to a transcript file,
implies -s
-c, --clear clear all history