diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-15 11:37:07 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-15 11:48:54 +0100 |
commit | f856ead9979631742f7d30315335828e66e0f6f6 (patch) | |
tree | 39a2b2126d44a25968473e9bf3bcfb3494290a00 /alot | |
parent | d39060104c049e7831b433054a53027b65d4a0b4 (diff) |
decorate envelope:toggletag
Diffstat (limited to 'alot')
-rw-r--r-- | alot/commands/__init__.py | 9 | ||||
-rw-r--r-- | alot/commands/envelope.py | 9 | ||||
-rw-r--r-- | alot/commands/search.py | 12 |
3 files changed, 15 insertions, 15 deletions
diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index 80778113..6629ac59 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -76,6 +76,7 @@ def commandfactory(cmdline, mode='global'): return None logging.debug('mode:%s got commandline "%s"' % (mode, cmdline)) args = shlex.split(cmdline.encode('utf-8')) + args = filter(lambda x: x.decode('utf-8'), args) logging.debug('ARGS: %s' % args) cmdname = args[0] args = args[1:] @@ -123,14 +124,6 @@ def commandfactory(cmdline, mode='global'): # if params: # h = {'To': params} # return commandfactory(cmd, mode=mode, headers=h) -# elif cmd == 'prompt': -# return commandfactory(cmd, mode=mode, startstring=params) -# elif cmd == 'refine': -# if mode == 'search': -# return commandfactory(cmd, mode=mode, query=params) -# elif mode == 'envelope': -# return commandfactory(cmd, mode=mode, key=params) -# # elif cmd == 'retag': # return commandfactory(cmd, mode=mode, tagsstring=params) # elif cmd == 'shellescape': diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 275d169f..116cee1a 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -205,12 +205,17 @@ class EnvelopeEditCommand(Command): ui.apply_command(cmd) -@registerCommand(MODE, 'set', {}) +@registerCommand(MODE, 'set', arguments=[ + (['--replace'], {'action': 'store_true', 'help':'remove old value'}), + (['key'], {'help':'header to refine'}), + (['value'], {'nargs':'+', 'help':'value'})] +) class EnvelopeSetCommand(Command): """sets header fields of mail open in envelope buffer""" - def __init__(self, key='', value=u'', replace=True, **kwargs): + def __init__(self, key, value, replace=True, **kwargs): self.key = key + value = ' '.join(value) self.value = encode_header(key, value) self.replace = replace Command.__init__(self, **kwargs) diff --git a/alot/commands/search.py b/alot/commands/search.py index 311b30a5..c275014f 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -28,13 +28,15 @@ class OpenThreadCommand(Command): sb.unfold_matching(query) -@registerCommand(MODE, 'toggletag', {}) +@registerCommand(MODE, 'toggletag', arguments=[ + (['tag'], {'nargs':'+', 'default':'', 'help':'tag to flip'})] +) class ToggleThreadTagCommand(Command): - """toggles tag in given or currently selected thread""" - def __init__(self, tags, thread=None, **kwargs): - assert tags + """toggles tags in given or currently selected thread""" + def __init__(self, tag, thread=None, **kwargs): + assert tag self.thread = thread - self.tags = set(tags) + self.tags = set(tag) Command.__init__(self, **kwargs) def apply(self, ui): |