summaryrefslogtreecommitdiff
path: root/docs/features
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2020-01-27 22:36:49 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2020-01-27 22:36:49 -0500
commit0f8f90cc2ade4135193f5399e5e6a12271668867 (patch)
treea3f8fd2c274fbac5293e218a70f55101f7b64633 /docs/features
parent95f8d883496044bcb95ce803752a8851de6ad0e5 (diff)
downloadcmd2-git-0f8f90cc2ade4135193f5399e5e6a12271668867.tar.gz
Made three public attributes of cmd2.Cmd no longer settable at runtime by end users
The 3 attributes are: - continuation_prompt - locals_in_py - prompt
Diffstat (limited to 'docs/features')
-rw-r--r--docs/features/builtin_commands.rst3
-rw-r--r--docs/features/embedded_python_shells.rst4
-rw-r--r--docs/features/initialization.rst2
-rw-r--r--docs/features/multiline_commands.rst10
-rw-r--r--docs/features/prompt.rst7
-rw-r--r--docs/features/settings.rst35
-rw-r--r--docs/features/transcripts.rst4
7 files changed, 26 insertions, 39 deletions
diff --git a/docs/features/builtin_commands.rst b/docs/features/builtin_commands.rst
index 540cfbb1..025149b3 100644
--- a/docs/features/builtin_commands.rst
+++ b/docs/features/builtin_commands.rst
@@ -93,14 +93,11 @@ within a running application:
(Cmd) set --long
allow_style: Terminal # Allow ANSI text style sequences in output (valid values: Terminal, Always, Never)
- continuation_prompt: > # On 2nd+ line of input
debug: False # Show full error stack on error
echo: False # Echo command issued into output
editor: vim # Program used by ``edit``
feedback_to_output: False # include nonessentials in `|`, `>` results
- locals_in_py: False # Allow access to your application in py via self
max_completion_items: 50 # Maximum number of CompletionItems to display during tab completion
- prompt: (Cmd) # The prompt issued to solicit input
quiet: False # Don't print nonessential feedback
timing: False # Report execution times
diff --git a/docs/features/embedded_python_shells.rst b/docs/features/embedded_python_shells.rst
index 9d721c2c..3386e8cd 100644
--- a/docs/features/embedded_python_shells.rst
+++ b/docs/features/embedded_python_shells.rst
@@ -10,9 +10,7 @@ your cmd2 application while maintaining isolation.
You may optionally enable full access to to your application by setting
``locals_in_py`` to ``True``. Enabling this flag adds ``self`` to the python
session, which is a reference to your Cmd2 application. This can be useful for
-debugging your application. To prevent users from enabling this ability
-manually you'll need to remove ``locals_in_py`` from the ``settable``
-dictionary.
+debugging your application.
The ``app`` object (or your custom name) provides access to application
commands through raw commands. For example, any application command call be
diff --git a/docs/features/initialization.rst b/docs/features/initialization.rst
index 39e36428..864741cd 100644
--- a/docs/features/initialization.rst
+++ b/docs/features/initialization.rst
@@ -110,7 +110,7 @@ override:
DisabledCommand objects.
- **echo**: if ``True``, each command the user issues will be repeated to the
screen before it is executed. This is particularly useful when running
- scripts. This behavior does not occur when a running command at the prompt.
+ scripts. This behavior does not occur when running a command at the prompt.
(Default: ``False``)
- **editor**: text editor program to use with *edit* command (e.g. ``vim``)
- **exclude_from_history**: commands to exclude from the *history* command
diff --git a/docs/features/multiline_commands.rst b/docs/features/multiline_commands.rst
index d6502058..769e0a64 100644
--- a/docs/features/multiline_commands.rst
+++ b/docs/features/multiline_commands.rst
@@ -10,3 +10,13 @@ blank line is *always* considered a command terminator (cannot be overridden).
In multiline commands, output redirection characters like ``>`` and ``|`` are
part of the command arguments unless they appear after the terminator.
+
+Continuation prompt
+-------------------
+
+When a user types a :ref:`Multiline Command
+<features/multiline_commands:Multiline Commands>` it may span more than one
+line of input. The prompt for the first line of input is specified by the
+``cmd2.Cmd.prompt`` instance attribute - see
+:ref:`features/prompt:Customizing the Prompt`. The prompt for subsequent lines
+of input is defined by the ``cmd2.Cmd.continuation_prompt`` attribute.
diff --git a/docs/features/prompt.rst b/docs/features/prompt.rst
index 40c50d2b..244ffb31 100644
--- a/docs/features/prompt.rst
+++ b/docs/features/prompt.rst
@@ -3,6 +3,13 @@ Prompt
``cmd2`` can issue a prompt before soliciting user input.
+Customizing the Prompt
+----------------------
+
+This prompt can be configured by setting the `cmd2.Cmd.prompt` instance
+attribute. This contains the string which should be printed as a prompt
+for user input.
+
Asynchronous Feedback
---------------------
diff --git a/docs/features/settings.rst b/docs/features/settings.rst
index b8f75934..55b6a10d 100644
--- a/docs/features/settings.rst
+++ b/docs/features/settings.rst
@@ -47,16 +47,6 @@ This setting can be one of three values:
- ``Always`` - ANSI escape sequences are always passed through to the output
-continuation_prompt
-~~~~~~~~~~~~~~~~~~~
-
-When a user types a :ref:`Multiline Command
-<features/multiline_commands:Multiline Commands>` it may span more than one
-line of input. The prompt for the first line of input is specified by the
-:ref:`features/settings:prompt` setting. The prompt for subsequent lines of
-input is defined by this setting.
-
-
debug
~~~~~
@@ -71,7 +61,7 @@ echo
If ``True``, each command the user issues will be repeated to the screen
before it is executed. This is particularly useful when running scripts.
-This behavior does not occur when a running command at the prompt.
+This behavior does not occur when running a command at the prompt.
editor
@@ -95,13 +85,6 @@ feedback output will be mixed in with and indistinguishable from output
generated with :meth:`~cmd2.cmd2.Cmd.poutput`.
-locals_in_py
-~~~~~~~~~~~~
-
-Allow access to your application in one of the
-:ref:`features/embedded_python_shells:Embedded Python Shells` via ``self``.
-
-
max_completion_items
~~~~~~~~~~~~~~~~~~~~
@@ -115,13 +98,6 @@ they will be displayed in the typical columnized format and will not include
the description text of the CompletionItem.
-prompt
-~~~~~~
-
-This setting contains the string which should be printed as a prompt for user
-input.
-
-
quiet
~~~~~
@@ -180,14 +156,13 @@ You may want to prevent a user from modifying a builtin setting. A setting
must appear in the :attr:`cmd2.cmd2.Cmd.settable` dictionary in order for it
to be available to the :ref:`features/builtin_commands:set` command.
-Let's say your program does not have any
-:ref:`features/multiline_commands:Multiline Commands`. You might want to hide
-the :ref:`features/settings:continuation_prompt` setting from your users since
-it is only applicable to multiline commands. To do so, remove it from the
+Let's say that you never want end users of your program to be able to enable
+full debug tracebacks to print out if an error occurs. You might want to hide
+the :ref:`features/settings:debug` setting. To do so, remove it from the
:attr:`cmd2.cmd2.Cmd.settable` dictionary after you initialize your object::
class MyApp(cmd2.Cmd):
def __init__(self):
super().__init__()
- self.settable.pop('continuation_prompt')
+ self.settable.pop('debug')
diff --git a/docs/features/transcripts.rst b/docs/features/transcripts.rst
index 9f524e0a..1af2a74f 100644
--- a/docs/features/transcripts.rst
+++ b/docs/features/transcripts.rst
@@ -146,8 +146,8 @@ the path instead of specifying it verbatim, or we can escape the slashes::
invisible, you can add a regular expression to match them, so that you can
see where they are when you look at the transcript::
- (Cmd) set prompt
- prompt: (Cmd)/ /
+ (Cmd) set editor
+ editor: vim/ /
Some terminal emulators strip trailing space when you copy text from them.
This could make the actual data generated by your app different than the