summaryrefslogtreecommitdiff
path: root/docs/api/cmd.rst
blob: f9bd07c6f2636b44235bce7bc0f07e0cee6a4fc6 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
cmd2.Cmd
========

.. autoclass:: cmd2.Cmd
    :members:

    .. automethod:: __init__

    .. attribute:: default_error

      The error message displayed when a non-existent command is run.
      Default: ``{} is not a recognized command, alias, or macro``

    .. attribute:: help_error

      The error message displayed to the user when they request help for a
      command with no help defined.
      Default:  ``No help on {}``

    .. attribute:: prompt

      The prompt issued to solicit input. The default value is ``(Cmd)``.
      See :ref:`features/prompt:Prompt` for more information.

    .. attribute:: continuation_prompt

      The prompt issued to solicit input for the 2nd and subsequent lines
      of a :ref:`multiline command <features/multiline_commands:Multiline Commands>`
      Default: ``>``.

    .. attribute:: echo

      If ``True``, output the prompt and user input before executing the command.
      When redirecting a series of commands to an output file, this allows you to
      see the command in the output.

    .. attribute:: settable

        This dictionary contains the name and description of all settings
        available to users.

        Users use the :ref:`features/builtin_commands:set` command to view and
        modify settings. Settings are stored in instance attributes with the
        same name as the setting.

    .. attribute:: history

        A record of previously entered commands.

        This attribute is an instance of :class:`cmd2.history.History`, and
        each command is an instance of :class:`cmd2.Statement`.

    .. attribute:: statement_parser

        An instance of :class:`cmd2.parsing.StatementParser` initialized and
        configured appropriately for parsing user input.

    .. attribute:: intro

        Set an introduction message which is displayed to the user before
        the :ref:`features/hooks:Command Processing Loop` begins.

    .. attribute:: py_bridge_name

        The symbol name which :ref:`features/scripting:Python Scripts` run
        using the :ref:`features/builtin_commands:run_pyscript` command can use
        to reference the parent ``cmd2`` application.

    .. attribute:: allow_clipboard

        If ``True``, ``cmd2`` will allow output to be written to or appended to
        the operating system pasteboard. If ``False``, this capability will not
        be allowed. See :ref:`features/clipboard:Clipboard Integration` for more
        information.