diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-08-28 21:14:45 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-09-03 22:14:08 +0100 |
commit | 79ca9ff0fd334f0f502b86193a2b6acdbef1d089 (patch) | |
tree | 91746936e0360003f1f0c8a83318419e5a4edf36 /alot | |
parent | 3286c8084aa3970dbba5200774a5c38481a8750a (diff) |
add CommandSequenceCommand
a meta command that allows to chain commands
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/globals.py | 13 | ||||
-rw-r--r-- | alot/ui.py | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 587cfa48..0f417851 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -749,3 +749,16 @@ class ComposeCommand(Command): spawn=self.force_spawn, refocus=False) ui.apply_command(cmd) + + +class CommandSequenceCommand(Command): + """Meta-Command that just applies a sequence of given Commands in order""" + + def __init__(self, commandlist=[]): + self.commandlist = commandlist + + @inlineCallbacks + def apply(self, ui): + for cmd in self.commandlist: + logging.debug('CMDSEQ: apply %s' % str(cmd)) + yield ui.apply(cmd) @@ -523,3 +523,4 @@ class UI(object): d = defer.maybeDeferred(cmd.apply, self) d.addErrback(errorHandler) d.addCallback(call_posthook) + return d |