summaryrefslogtreecommitdiff
path: root/docs/source/api/commands.rst
blob: cae10a03419800308737daf86f8166b6f0f4f961 (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
75
76
77
78
79
80
Commands
=========

.. module:: alot.commands

User actions are represented by :class:`Command` objects that can then be triggered by
:meth:`alot.ui.UI.apply_command`.
Command-line strings given by the user via the prompt or key bindings can be translated to
:class:`Command` objects using :func:`alot.commands.commandfactory`.
Specific actions are defined as subclasses of :class:`Command` and can be registered
to a global command pool using the :class:`registerCommand` decorator.

.. Note::

    that the return value
    of :func:`commandfactory` depends on the current *mode* the user interface is in.
    The mode identifier is a string that is uniquely defined by the currently focuses
    :class:`~alot.buffers.Buffer`.

.. note::

    The names of the commands available to the user in any given mode do not correspond
    one-to-one to these subclasses. You can register a Command multiple times under different
    names, with different forced constructor parameters and so on. See for instance the
    definition of BufferFocusCommand in 'commands/globals.py'::

        @registerCommand(MODE, 'bprevious', forced={'offset': -1},
                         help='focus previous buffer')
        @registerCommand(MODE, 'bnext', forced={'offset': +1},
                         help='focus next buffer')
        class BufferFocusCommand(Command):
            def __init__(self, buffer=None, offset=0, **kwargs):
            ...

.. autoclass:: Command
    :members:

.. autoclass:: CommandParseError
.. autoclass:: CommandArgumentParser
.. autofunction:: commandfactory
.. autofunction:: lookup_command
.. autofunction:: lookup_parser
.. autoclass:: registerCommand


Globals
--------

.. automodule:: alot.commands.globals
  :members:

Envelope
--------

.. automodule:: alot.commands.envelope
  :members:

Bufferlist
----------

.. automodule:: alot.commands.bufferlist
  :members:

Search
--------

.. automodule:: alot.commands.search
  :members:

Taglist
--------

.. automodule:: alot.commands.taglist
  :members:

Thread
--------

.. automodule:: alot.commands.thread
  :members: