diff options
Diffstat (limited to 'alot/commands/search.py')
-rw-r--r-- | alot/commands/search.py | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/alot/commands/search.py b/alot/commands/search.py index 63572e68..5fb8324a 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -42,11 +42,11 @@ class OpenThreadCommand(Command): @registerCommand(MODE, 'refine', help='refine query', arguments=[ (['--sort'], {'help': 'sort order', 'choices': [ - 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), + 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), (['query'], {'nargs': argparse.REMAINDER, 'help': 'search string'})]) @registerCommand(MODE, 'sort', help='set sort order', arguments=[ (['sort'], {'help': 'sort order', 'choices': [ - 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), + 'oldest_first', 'newest_first', 'message_id', 'unsorted']}), ]) class RefineCommand(Command): @@ -110,42 +110,50 @@ class RetagPromptCommand(Command): return ui.apply_command(PromptCommand('retag ' + initial_tagstring)) -@registerCommand(MODE, 'tag', forced={'action': 'add'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': - False, 'help': 'retag all messages in search result'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'tag', forced={'action': 'add'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': + False, 'help': 'retag all messages in search result'}), + (['tags'], {'help': 'comma separated list of tags'})], help='add tags to all messages in the thread that match the current query', ) -@registerCommand(MODE, 'retag', forced={'action': 'set'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': - False, 'help': 'retag all messages in search result'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'retag', forced={'action': 'set'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': + False, 'help': 'retag all messages in search result'}), + (['tags'], {'help': 'comma separated list of tags'})], help='set tags of all messages in the thread that match the current query', ) -@registerCommand(MODE, 'untag', forced={'action': 'remove'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': - False, 'help': 'retag all messages in search result'}), - (['tags'], {'help': 'comma separated list of tags'})], +@registerCommand( + MODE, 'untag', forced={'action': 'remove'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['--all'], {'action': 'store_true', 'dest': 'allmessages', 'default': + False, 'help': 'retag all messages in search result'}), + (['tags'], {'help': 'comma separated list of tags'})], help='remove tags from all messages in the thread that match the query', ) -@registerCommand(MODE, 'toggletags', forced={'action': 'toggle'}, arguments=[ - (['--no-flush'], {'action': 'store_false', 'dest': 'flush', - 'default': 'True', - 'help': 'postpone a writeout to the index'}), - (['tags'], {'help': 'comma separated list of tags'})], - help="""flip presence of tags on this thread. - A tag is considered present if at least one message contained in this - thread is tagged with it. In that case this command will remove the tag - from every message in the thread.""") +@registerCommand( + MODE, 'toggletags', forced={'action': 'toggle'}, + arguments=[ + (['--no-flush'], {'action': 'store_false', 'dest': 'flush', + 'default': 'True', + 'help': 'postpone a writeout to the index'}), + (['tags'], {'help': 'comma separated list of tags'})], + help='flip presence of tags on this thread. A tag is considered present ' + 'if at least one message contained in this thread is tagged with it. ' + 'In that case this command will remove the tag from every message in ' + 'the thread.') class TagCommand(Command): """manipulate message tags""" @@ -240,10 +248,9 @@ class TagCommand(Command): ui.apply_command(commands.globals.FlushCommand(callback=refresh)) -@registerCommand(MODE, 'move', help='move focus in search buffer', - arguments=[(['movement'], { - 'nargs': argparse.REMAINDER, - 'help': 'last'})]) +@registerCommand( + MODE, 'move', help='move focus in search buffer', + arguments=[(['movement'], {'nargs': argparse.REMAINDER, 'help': 'last'})]) class MoveFocusCommand(MoveCommand): def apply(self, ui): |