diff options
author | kotfu <kotfu@kotfu.net> | 2019-07-16 22:40:33 -0500 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2019-07-16 22:40:33 -0500 |
commit | 08f43bf2ff9f810041eb1113f2a543395cc3ea4a (patch) | |
tree | ac86baa54645b6f4032b20ba0e4eb8e6c24f63d6 /docs/features/settings.rst | |
parent | c84dad55b7b822ea2109d6b56f483ee449012aa9 (diff) | |
download | cmd2-git-08f43bf2ff9f810041eb1113f2a543395cc3ea4a.tar.gz |
Integrate ‘parameter changes’ document into new doc structure
Diffstat (limited to 'docs/features/settings.rst')
-rw-r--r-- | docs/features/settings.rst | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/docs/features/settings.rst b/docs/features/settings.rst index 27730572..21d5a9ee 100644 --- a/docs/features/settings.rst +++ b/docs/features/settings.rst @@ -5,6 +5,68 @@ Settings - how a developer can add their own - how to hide built in settings from a user +Built In Settings +----------------- + +``cmd2`` has a number of built in settings, which a developer can set a default +value, and which users can modify to change the behavior of the application. + + +Timing +~~~~~~ + +Setting ``App.timing`` to ``True`` outputs timing data after every application +command is executed. |settable| + + +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. + + +Debug +~~~~~ + +Setting ``App.debug`` to ``True`` will produce detailed error stacks whenever +the application generates an error. |settable| + +.. |settable| replace:: The user can ``set`` this parameter + during application execution. + (See :ref:`parameters`) + +.. _parameters: + +Other user-settable parameters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A list of all user-settable parameters, with brief +comments, is viewable from within a running application +with:: + + (Cmd) set --long + allow_ansi: Terminal # Allow ANSI escape 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 + prompt: (Cmd) # The prompt issued to solicit input + quiet: False # Don't print nonessential feedback + timing: False # Report execution times + +Any of these user-settable parameters can be set while running your app with +the ``set`` command like so:: + + set allow_ansi Never + + + +Create New Settings +------------------- + Your application can define user-settable parameters which your code can reference. First create a class attribute with the default value. Then update the ``settable`` dictionary with your setting name and a short description |