diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-07-03 10:31:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-03 10:31:14 -0400 |
commit | 96c8144d1fa73b85b93ffab7bf8f86f8f0c8bd69 (patch) | |
tree | b90c7af80b9936fef2d44794c7a591dd3a351663 /docs/features/scripting.rst | |
parent | a7511e16b9bddd1c8245dc57bd62370e7fd7b1c7 (diff) | |
parent | 033e203348b9601f84b25c244c919fd6ad35987f (diff) | |
download | cmd2-git-96c8144d1fa73b85b93ffab7bf8f86f8f0c8bd69.tar.gz |
Merge pull request #947 from python-cmd2/pyscript_docs
Further additions to pyscript documenntation for Issue #644
Diffstat (limited to 'docs/features/scripting.rst')
-rw-r--r-- | docs/features/scripting.rst | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/docs/features/scripting.rst b/docs/features/scripting.rst index 52647927..141eaa62 100644 --- a/docs/features/scripting.rst +++ b/docs/features/scripting.rst @@ -94,11 +94,29 @@ where: * ``command`` and ``args`` are entered exactly like they would be entered by a user of your application. +See python_scripting_ example and associated conditional_ script for more +information. + +Advanced Support +~~~~~~~~~~~~~~~~ + +When implementing a command, setting ``self.last_result`` allows for application-specific +data to be returned to a python script from the command. This can allow python scripts to +make decisions based on the result of previous application commands. + +The application command (default: ``app``) returns a ``cmd2.CommandResult`` for each command. +The ``cmd2.CommandResult`` object provides the captured output to ``stdout`` and ``stderr`` +while a command is executing. Additionally, it provides the value that command stored in +``self.last_result``. + +Additionally, an external test Mixin plugin has been provided to allow for python based +external testing of the application. For example, for system integration tests scenarios +where the python application is a component of a larger suite of tools and components. This +interface allows python based tests to call commands and validate results as part of a +larger test suite. See :ref:`plugins/external_test:External Test Plugin` + .. _python_scripting: https://github.com/python-cmd2/cmd2/blob/master/examples/python_scripting.py .. _conditional: https://github.com/python-cmd2/cmd2/blob/master/examples/scripts/conditional.py - -See python_scripting_ example and associated conditional_ script for more -information. |