Skip to content

Commit 79c54b4

Browse files
committed
Updated various documentation and tests to not use load
1 parent ea1716a commit 79c54b4

File tree

7 files changed

+18
-17
lines changed

7 files changed

+18
-17
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Main Features
3232
- Special-character command shortcuts (beyond cmd's `?` and `!`)
3333
- Command aliasing similar to bash `alias` command
3434
- Macros, which are similar to aliases, but they can contain argument placeholders
35-
- Ability to load commands at startup from an initialization script
35+
- Ability to run commands at startup from an initialization script
3636
- Settable environment parameters
3737
- Parsing commands with arguments using `argparse`, including support for sub-commands
3838
- Unicode character support
@@ -109,12 +109,12 @@ Instructions for implementing each feature follow.
109109
- Simple scripting using ASCII text files with one command + arguments per line
110110
- See the [Script files](https://cmd2.readthedocs.io/en/latest/freefeatures.html#script-files) section of the `cmd2` docs for more info
111111
- See [script.txt](https://github.com/python-cmd2/cmd2/blob/master/examples/scripts/script.txt) for a trivial example script that can be
112-
used in any `cmd2` application with the `load` command (or `@` shortcut)
112+
used in any `cmd2` application with the `run_script` command (or `@` shortcut)
113113

114114
- Powerful and flexible built-in Python scripting of your application using the `run_pyscript` command
115115
- Run arbitrary Python scripts within your `cmd2` application with the ability to also call custom `cmd2` commands
116116
- No separate API for your end users to learn
117-
- Syntax for calling `cmd2` commands in a `pyscript` is essentially identical to what they would enter on the command line
117+
- Syntax for calling `cmd2` commands in a `run_pyscript` is essentially identical to what they would enter on the command line
118118
- See the [Python](https://cmd2.readthedocs.io/en/latest/freefeatures.html#python) section of the `cmd2` docs for more info
119119
- Also see the [python_scripting.py](https://github.com/python-cmd2/cmd2/blob/master/examples/python_scripting.py)
120120
example in conjunction with the [conditional.py](https://github.com/python-cmd2/cmd2/blob/master/examples/scripts/conditional.py) script

docs/integrating.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ loop::
4545

4646
Documented commands (type help <topic>):
4747
========================================
48-
alias help load orate pyscript say shell speak
49-
edit history mumble py quit set shortcuts unalias
48+
alias history mumble pyscript run_script shell
49+
edit load orate quit say shortcuts
50+
help macro py run_pyscript set speak
5051

5152
(Cmd)
5253

docs/unfreefeatures.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,10 @@ the help categories with per-command Help Messages::
359359
edit Edit a file in a text editor
360360
help List available commands with "help" or detailed help with "help cmd"
361361
history usage: history [-h] [-r | -e | -s | -o FILE | -t TRANSCRIPT] [arg]
362-
load Runs commands in script file that is encoded as either ASCII or UTF-8 text
363362
py Invoke python command, shell, or script
364-
pyscript Runs a python script file inside the console
365363
quit Exits this application
364+
run_pyscript Runs a python script file inside the console
365+
run_script Runs commands in script file that is encoded as either ASCII or UTF-8 text
366366
set usage: set [-h] [-a] [-l] [settable [settable ...]]
367367
shell Execute a command as if at the OS prompt
368368
shortcuts Lists shortcuts available

examples/persistent_history.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
class Cmd2PersistentHistory(cmd2.Cmd):
1212
"""Basic example of how to enable persistent readline history within your cmd2 app."""
1313
def __init__(self, hist_file):
14-
"""Configure the app to load persistent readline history from a file.
14+
"""Configure the app to load persistent history from a file (both readline and cmd2 history command affected).
1515
16-
:param hist_file: file to load readline history from at start and write it to at end
16+
:param hist_file: file to load history from at start and write it to at end
1717
"""
1818
super().__init__(persistent_history_file=hist_file, persistent_history_length=500, allow_cli_args=False)
1919
self.prompt = 'ph> '

examples/python_scripting.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# coding=utf-8
33
"""A sample application for how Python scripting can provide conditional control flow of a cmd2 application.
44
5-
cmd2's built-in scripting capability which can be invoked via the "@" shortcut or "load" command and uses basic ASCII
6-
text scripts is very easy to use. Moreover, the trivial syntax of the script files where there is one command per line
7-
and the line is exactly what the user would type inside the application makes it so non-technical end users can quickly
8-
learn to create scripts.
5+
cmd2's built-in scripting capability which can be invoked via the "@" shortcut or "run_script" command and uses basic
6+
ASCII text scripts is very easy to use. Moreover, the trivial syntax of the script files where there is one command per
7+
line and the line is exactly what the user would type inside the application makes it so non-technical end users can
8+
quickly learn to create scripts.
99
1010
However, there comes a time when technical end users want more capability and power. In particular it is common that
1111
users will want to create a script with conditional control flow - where the next command run will depend on the results

tests/test_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ def test_basic_completion_nomatch(cmd2_app):
537537

538538
def test_delimiter_completion(cmd2_app):
539539
text = '/home/'
540-
line = 'load {}'.format(text)
540+
line = 'run_script {}'.format(text)
541541
endidx = len(line)
542542
begidx = endidx - len(text)
543543

tests/test_transcript.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_history_transcript_bad_filename():
190190
assert transcript == expected
191191

192192

193-
def test_load_record_transcript(base_app, request):
193+
def test_run_script_record_transcript(base_app, request):
194194
test_dir = os.path.dirname(request.module.__file__)
195195
filename = os.path.join(test_dir, 'scripts', 'help.txt')
196196

@@ -201,8 +201,8 @@ def test_load_record_transcript(base_app, request):
201201
fd, transcript_fname = tempfile.mkstemp(prefix='', suffix='.trn')
202202
os.close(fd)
203203

204-
# Run the load command with the -r option to generate a transcript
205-
run_cmd(base_app, 'load {} -t {}'.format(filename, transcript_fname))
204+
# Execute the run_script command with the -t option to generate a transcript
205+
run_cmd(base_app, 'run_script {} -t {}'.format(filename, transcript_fname))
206206

207207
assert base_app._script_dir == []
208208
assert base_app._current_script_dir is None

0 commit comments

Comments
 (0)