From c9cd9d36b6103f17a265b334397af88655797e19 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sun, 8 Jan 2012 18:17:32 +0000 Subject: add retag command for thread buffer that tags selection with given tags and removes all other tags from the message(s) issue #236 --- alot/commands/thread.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 3bab332f..07edfefe 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -623,6 +623,9 @@ class ThreadSelectCommand(Command): @registerCommand(MODE, 'tag', forced={'action': 'add'}, arguments=[ (['--all'], {'action': 'store_true', 'help':'tag all messages in thread'}), (['tags'], {'help':'comma separated list of tags'})]) +@registerCommand(MODE, 'retag', forced={'action': 'set'}, arguments=[ + (['--all'], {'action': 'store_true', 'help':'retag all messages in thread'}), + (['tags'], {'help':'comma separated list of tags'})]) @registerCommand(MODE, 'untag', forced={'action': 'remove'}, arguments=[ (['--all'], {'action': 'store_true', 'help':'tag all messages in thread'}), (['tags'], {'help':'comma separated list of tags'})]) @@ -637,8 +640,9 @@ class TagCommand(Command): :type tags: str :param all: tag all messages in thread :type all: bool - :param action: adds tags if 'add', removes them if 'remove' or toggle - individually if 'toggle' + :param action: adds tags if 'add', removes them if 'remove', adds tags + and removes all other if 'set' or toggle individually if + 'toggle' :type action: str """ self.tagsstring = tags @@ -663,6 +667,9 @@ class TagCommand(Command): for m in messages: if self.action == 'add': m.add_tags(tags, afterwards=refresh_widgets) + if self.action == 'set': + m.add_tags(tags, afterwards=refresh_widgets, + remove_rest=True) elif self.action == 'remove': m.remove_tags(tags, afterwards=refresh_widgets) elif self.action == 'toggle': -- cgit v1.2.3