@@ -13,24 +13,15 @@ Script files
1313============
1414
1515Text files can serve as scripts for your ``cmd2 ``-based
16- application, with the ``load ``, ``_relative_load ``, and ``edit `` commands.
16+ application, with the ``run_script ``, ``_relative_run_script ``, and ``edit `` commands.
1717
1818Both ASCII and UTF-8 encoded unicode text files are supported.
1919
2020Simply include one command per line, typed exactly as you would inside a ``cmd2 `` application.
2121
22- The ``load `` command loads commands from a script file into a queue and then the normal cmd2 REPL
23- resumes control and executes the commands in the queue in FIFO order. A side effect of this
24- is that if you redirect/pipe the output of a load command, it will redirect the output of the ``load ``
25- command itself, but will NOT redirect the output of the command loaded from the script file. Of course,
26- you can add redirection to the commands being run in the script file, e.g.::
22+ .. automethod :: cmd2.cmd2.Cmd.do_run_script
2723
28- # This is your script file
29- command arg1 arg2 > file.txt
30-
31- .. automethod :: cmd2.cmd2.Cmd.do_load
32-
33- .. automethod :: cmd2.cmd2.Cmd.do__relative_load
24+ .. automethod :: cmd2.cmd2.Cmd.do__relative_run_script
3425
3526.. automethod :: cmd2.cmd2.Cmd.do_edit
3627
@@ -51,7 +42,7 @@ Comments can be useful in :ref:`scripts`, but would be pointless within an inter
5142
5243Startup Initialization Script
5344=============================
54- You can load and execute commands from a startup initialization script by passing a file path to the ``startup_script ``
45+ You can execute commands from a startup initialization script by passing a file path to the ``startup_script ``
5546argument to the ``cmd2.Cmd.__init__() `` method like so::
5647
5748 class StartupApp(cmd2.Cmd):
@@ -188,16 +179,16 @@ conditional control flow logic. See the **python_scripting.py** ``cmd2`` applic
188179the **script_conditional.py ** script in the ``examples `` source code directory for an
189180example of how to achieve this in your own applications.
190181
191- Using ``py `` to run scripts directly is considered deprecated. The newer ``pyscript `` command
182+ Using ``py `` to run scripts directly is considered deprecated. The newer ``run_pyscript `` command
192183is superior for doing this in two primary ways:
193184
194185- it supports tab-completion of file system paths
195186- it has the ability to pass command-line arguments to the scripts invoked
196187
197- There are no disadvantages to using ``pyscript `` as opposed to ``py run() ``. A simple example
198- of using ``pyscript `` is shown below along with the arg_printer _ script::
188+ There are no disadvantages to using ``run_pyscript `` as opposed to ``py run() ``. A simple example
189+ of using ``run_pyscript `` is shown below along with the arg_printer _ script::
199190
200- (Cmd) pyscript examples/scripts/arg_printer.py foo bar baz
191+ (Cmd) run_pyscript examples/scripts/arg_printer.py foo bar baz
201192 Running Python script 'arg_printer.py' which was called with 3 arguments
202193 arg 1: 'foo'
203194 arg 2: 'bar'
@@ -390,7 +381,7 @@ would::
390381
391382If you want to save the commands to a text file, but not edit and re-run them,
392383use the ``-o `` or ``--output-file `` option. This is a great way to create
393- :ref: `scripts `, which can be loaded and executed using the ``load `` command. To
384+ :ref: `scripts `, which can be executed using the ``run_script `` command. To
394385save the first 5 commands entered in this session to a text file::
395386
396387 (Cmd) history :5 -o history.txt
@@ -512,8 +503,8 @@ Tab-Completion
512503``cmd2 `` adds tab-completion of file system paths for all built-in commands where it makes sense, including:
513504
514505- ``edit ``
515- - ``load ``
516- - ``pyscript ``
506+ - ``run_pyscript ``
507+ - ``run_script ``
517508- ``shell ``
518509
519510``cmd2 `` also adds tab-completion of shell commands to the ``shell `` command.
0 commit comments