summaryrefslogtreecommitdiff
path: root/docs/features/builtin_commands.rst
blob: ab4ca60e43caa7bbdef124fc3789c6a0ad8b2814 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
Builtin Commands
================

Applications which subclass :class:`cmd2.cmd2.Cmd` inherit a number of commands
which may be useful to your users.

edit
----

This command launches an editor program and instructs it to open the given file
name. Here's an example::

  (Cmd) edit ~/.ssh/config

The program to be launched is determined by the value of the
:ref:`features/settings:editor` setting.


set
---

A list of all user-settable parameters, with brief comments, is viewable from
within a running application::

    (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
    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

Any of these user-settable parameters can be set while running your app with
the ``set`` command like so::

    (Cmd) set allow_ansi Never


Removing A Builtin Command
--------------------------

[TODO] show how to remove a builtin command if you don't want it available to
your users.