diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-11-02 16:06:50 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-11-02 16:06:50 -0400 |
commit | f3cebffef9bf1b562e1da39ea1ef11d18e6b6b39 (patch) | |
tree | c3bf527c6e27129d198bf1920e04c6db4186f35a /docs/features/misc.rst | |
parent | 12ade7ba7b3adde4c225b965cd4a558574c6c304 (diff) | |
download | cmd2-git-f3cebffef9bf1b562e1da39ea1ef11d18e6b6b39.tar.gz |
Moved docs on "Commands at Invocation" and "Startup Script" from Miscellaneous section to "Startup Commands" section
Diffstat (limited to 'docs/features/misc.rst')
-rw-r--r-- | docs/features/misc.rst | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/docs/features/misc.rst b/docs/features/misc.rst index 92ab7537..68a92b6a 100644 --- a/docs/features/misc.rst +++ b/docs/features/misc.rst @@ -30,55 +30,6 @@ to type:: (Cmd) !ls -al -Commands At Invocation ----------------------- - -.. _Argparse: https://docs.python.org/3/library/argparse.html - -You can send commands to your app as you invoke it by including them as extra -arguments to the program. ``cmd2`` interprets each argument as a separate -command, so you should enclose each command in quotation marks if it is more -than a one-word command. - -.. code-block:: shell - - $ python examples/example.py "say hello" "say Gracie" quit - hello - Gracie - - -.. note:: - - If you wish to disable cmd2's consumption of command-line arguments, you can - do so by setting the ``allow_cli_args`` argument of your ``cmd2.Cmd`` class - instance to ``False``. This would be useful, for example, if you wish to - use something like Argparse_ to parse the overall command line arguments for - your application:: - - from cmd2 import Cmd - class App(Cmd): - def __init__(self): - super().__init__(allow_cli_args=False) - - -Initialization Script ---------------------- - -.. _AliasStartup: https://github.com/python-cmd2/cmd2/blob/master/examples/alias_startup.py - -You can execute commands from an initialization script by passing a file -path to the ``startup_script`` argument to the ``cmd2.Cmd.__init__()`` method -like so:: - - class StartupApp(cmd2.Cmd): - def __init__(self): - cmd2.Cmd.__init__(self, startup_script='.cmd2rc') - -This text file should contain a :ref:`Command Script -<features/scripting:Command Scripts>`. See the AliasStartup_ example for a -demonstration. - - select ------ |