diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-16 16:30:16 +0100 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-10-16 16:30:16 +0100 |
commit | b4943f3e0b88a95691ed5d83e79d3c12ce6084d4 (patch) | |
tree | 227459833276cfc5ebce61f47b2ac9bf1326af5f | |
parent | ac2f01a54790f4cded4cc21ebb64c8bdac1f0a2f (diff) |
fix envelope:set
-rw-r--r-- | alot/commands/envelope.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index c5f5c96a..7813c130 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -203,23 +203,21 @@ class EnvelopeEditCommand(Command): @registerCommand(MODE, 'set', help='set header value', arguments=[ - (['--replace'], {'action': 'store_true', 'help':'remove old value'}), + (['--append'], {'action': 'store_true', 'help':'keep previous 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, replace=True, **kwargs): + def __init__(self, key, value, append=False, **kwargs): self.key = key - value = ' '.join(value) - self.value = encode_header(key, value) - self.replace = replace + self.value = encode_header(key, ' '.join(value)) + self.append = append Command.__init__(self, **kwargs) def apply(self, ui): envelope = ui.current_buffer mail = envelope.get_email() - if self.replace: + if not self.append: del(mail[self.key]) mail[self.key] = self.value + envelope.set_email(mail) envelope.rebuild() |