summaryrefslogtreecommitdiff
path: root/alot/ui.py
diff options
context:
space:
mode:
Diffstat (limited to 'alot/ui.py')
-rw-r--r--alot/ui.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/alot/ui.py b/alot/ui.py
index 81d61556..e9413c81 100644
--- a/alot/ui.py
+++ b/alot/ui.py
@@ -9,7 +9,9 @@ from settings import settings
from buffers import BufferlistBuffer
from commands import commandfactory
from alot.commands import CommandParseError
+from alot.commands.globals import CommandSequenceCommand
from alot.helper import string_decode
+from alot.helper import split_commandline
from alot.widgets.globals import CompleteEdit
from alot.widgets.globals import ChoiceWidget
@@ -141,6 +143,21 @@ class UI(object):
# update statusbar
self.update()
+ def apply_commandline(self, cmdline):
+ # split commandline if necessary
+ cmd = None
+ cmdlist = split_commandline(cmdline)
+ if len(cmdlist) == 1:
+ try:
+ # translate cmdstring into :class:`Command`
+ cmd = commandfactory(cmdlist[0], self.mode)
+ except CommandParseError, e:
+ self.notify(e.message, priority='error')
+ return
+ else:
+ cmd = CommandSequenceCommand(cmdlist)
+ self.apply_command(cmd)
+
def _unhandeled_input(self, key):
"""
Called by :class:`urwid.MainLoop` if a keypress was passed to the root