diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:16:10 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-04 22:16:10 -0500 |
commit | b4e7cc7cb2de1bd78d65a250caab91dc6cd90221 (patch) | |
tree | e7c62918c696a105b6ab8ce6b7c3322006d1c566 /docs | |
parent | 123ac08169078cd8d232ae39102534782ac7fd87 (diff) | |
parent | eb86c739187583a7afdd56e0a9fcf0da212562f1 (diff) | |
download | cmd2-git-b4e7cc7cb2de1bd78d65a250caab91dc6cd90221.tar.gz |
Merge master into with_argument_list and resolved conflicts
Diffstat (limited to 'docs')
-rw-r--r-- | docs/freefeatures.rst | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/docs/freefeatures.rst b/docs/freefeatures.rst index b6c7bebd..a34d9fcc 100644 --- a/docs/freefeatures.rst +++ b/docs/freefeatures.rst @@ -29,23 +29,16 @@ Simply include one command per line, typed exactly as you would inside a ``cmd2` Comments ======== -Comments are omitted from the argument list -before it is passed to a ``do_`` method. By -default, both Python-style and C-style comments -are recognized. Comments can be useful in :ref:`scripts`, but would -be pointless within an interactive session. +Any command line input where the first non-whitespace character is a # will be treated as a comment. +This means any # character appearing later in the command will be treated as a literal. The same +applies to a # in the middle of a multiline command, even if it is the first character on a line. -:: - - def do_speak(self, arg): - self.stdout.write(arg + '\n') +Comments can be useful in :ref:`scripts`, but would be pointless within an interactive session. :: - (Cmd) speak it was /* not */ delicious! # Yuck! - it was delicious! - -.. _arg_print: https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py + (Cmd) # this is a comment + (Cmd) this # is not a comment Startup Initialization Script ============================= @@ -209,9 +202,9 @@ is superior for doing this in two primary ways: - it has the ability to pass command-line arguments to the scripts invoked There are no disadvantages to using ``pyscript`` as opposed to ``py run()``. A simple example -of using ``pyscript`` is shown below along with the **examples/arg_printer.py** script:: +of using ``pyscript`` is shown below along with the arg_printer_ script:: - (Cmd) pyscript examples/arg_printer.py foo bar baz + (Cmd) pyscript examples/scripts/arg_printer.py foo bar baz Running Python script 'arg_printer.py' which was called with 3 arguments arg 1: 'foo' arg 2: 'bar' @@ -226,8 +219,8 @@ of using ``pyscript`` is shown below along with the **examples/arg_printer.py** $ examples/arg_print.py (Cmd) lprint foo "bar baz" - lprint was called with the following list of arguments: ['foo', 'bar baz'] +.. _arg_printer: https://github.com/python-cmd2/cmd2/blob/master/examples/scripts/arg_printer.py IPython (optional) ================== |