summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-02-27 09:08:25 -0500
committerGitHub <noreply@github.com>2018-02-27 09:08:25 -0500
commit27a8a15ce6fa1ace148573110d612563a05ec516 (patch)
tree82bd24661826b2fa5e6c4db4c307f588e54ceb23
parent41c5484c3d198ceba9115710e79082790ab40a08 (diff)
parentc46e0a690ce9ad72e2c6e3e6f06d63df3261f833 (diff)
downloadcmd2-git-27a8a15ce6fa1ace148573110d612563a05ec516.tar.gz
Merge pull request #285 from python-cmd2/transcript_poutput
Improved the documentation regarding poutput
-rw-r--r--docs/transcript.rst6
-rw-r--r--docs/unfreefeatures.rst5
2 files changed, 11 insertions, 0 deletions
diff --git a/docs/transcript.rst b/docs/transcript.rst
index a2db3efd..36b35fcf 100644
--- a/docs/transcript.rst
+++ b/docs/transcript.rst
@@ -26,6 +26,12 @@ A transcript can automatically generated based upon commands previously executed
This is by far the easiest way to generate a transcript.
+.. warning::
+
+ Make sure you use the **poutput()** method in your ``cmd2`` application for generating command output. This method
+ of the ``cmd2.Cmd`` class ensure that output is properly redirected when redirecting to a file, piping to a shell
+ command, and when generating a transcript.
+
Manually
--------
Here's a transcript created from ``python examples/example.py``::
diff --git a/docs/unfreefeatures.rst b/docs/unfreefeatures.rst
index 2d497101..e92bf2d6 100644
--- a/docs/unfreefeatures.rst
+++ b/docs/unfreefeatures.rst
@@ -155,9 +155,14 @@ but ``print`` decreases output flexibility). ``cmd2`` applications can use
``self.poutput('output')``, ``self.pfeedback('message')``, and ``self.perror('errmsg')``
instead. These methods have these advantages:
+- Handle output redirection to file and/or pipe appropriately
- More concise
- ``.pfeedback()`` destination is controlled by :ref:`quiet` parameter.
+.. automethod:: cmd2.Cmd.poutput
+.. automethod:: cmd2.Cmd.perror
+.. automethod:: cmd2.Cmd.pfeedback
+
color
=====