diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-02-24 00:22:39 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-02-24 00:22:39 -0500 |
commit | 414e34e01efeaa0153dd1d6f9c1231761d9a3d6c (patch) | |
tree | 327e9d3400d6a4f6a1338043ee29cfda3d3e9404 /docs | |
parent | 656a7742f0f15bf64f259e4f32b1d0a082fcfc83 (diff) | |
download | cmd2-git-414e34e01efeaa0153dd1d6f9c1231761d9a3d6c.tar.gz |
Improved the documentation regarding poutput, particularly with transcripts
The documentation didn't make it very clear that the poutput() method should be used for generating output from cmd2 commands. This PR attempts to fix that.
This closes #275.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/transcript.rst | 6 | ||||
-rw-r--r-- | docs/unfreefeatures.rst | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/docs/transcript.rst b/docs/transcript.rst index a2db3efd..184f129d 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, pipeing 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 ===== |