diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-16 15:04:47 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-17 12:03:38 +0000 |
commit | 947edb94410bb5fa7afadef2023c2820f1e029cf (patch) | |
tree | 070c39b5fd914c7799a9c7dde4bd28ae22a2935d /alot/commands/envelope.py | |
parent | 15898ed642335831baaf31497ec71357e7a4b363 (diff) |
implement envelope.set --append
`set --append K V` in envelope mode
will append the new K-header value V.
(defaults to overwrite)
Diffstat (limited to 'alot/commands/envelope.py')
-rw-r--r-- | alot/commands/envelope.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 2597e9de..7e17be3a 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -207,8 +207,7 @@ class EditCommand(Command): @registerCommand(MODE, 'set', arguments=[ - # TODO - #(['--append'], {'action': 'store_true', 'help':'keep previous value'}), + (['--append'], {'action': 'store_true', 'help':'keep previous values'}), (['key'], {'help':'header to refine'}), (['value'], {'nargs':'+', 'help':'value'})]) class SetCommand(Command): @@ -222,11 +221,13 @@ class SetCommand(Command): """ self.key = key self.value = ' '.join(value) - self.append = append + self.reset = not append Command.__init__(self, **kwargs) def apply(self, ui): - ui.current_buffer.envelope[self.key] = self.value + if self.reset: + del(ui.current_buffer.envelope[self.key]) + ui.current_buffer.envelope.add(self.key, self.value) ui.current_buffer.rebuild() |