diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-10 14:18:52 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2011-12-10 14:20:36 +0000 |
commit | eada26f35ee24bbb71d1fbbba8f6f78f09954da1 (patch) | |
tree | cbbd3cc1c539065b59c74020a2bfbd58010d32bf | |
parent | 938b71a2c7fda0c51925da7c212f07e77e182c92 (diff) |
docstrings for search and bufferlist commands
-rw-r--r-- | alot/commands/bufferlist.py | 6 | ||||
-rw-r--r-- | alot/commands/search.py | 45 | ||||
-rw-r--r-- | alot/commands/taglist.py | 3 |
3 files changed, 39 insertions, 15 deletions
diff --git a/alot/commands/bufferlist.py b/alot/commands/bufferlist.py index 4466865b..ed5f9cc5 100644 --- a/alot/commands/bufferlist.py +++ b/alot/commands/bufferlist.py @@ -3,15 +3,17 @@ from alot.commands import Command, registerCommand MODE = 'bufferlist' -@registerCommand(MODE, 'select', help='focus selected buffer') +@registerCommand(MODE, 'select') class BufferFocusCommand(Command): + """focus selected buffer""" def apply(self, ui): selected = ui.current_buffer.get_selected_buffer() ui.buffer_focus(selected) -@registerCommand(MODE, 'close', help='close focussed buffer') +@registerCommand(MODE, 'close') class BufferCloseCommand(Command): + """close focussed buffer""" def apply(self, ui): bufferlist = ui.current_buffer selected = bufferlist.get_selected_buffer() diff --git a/alot/commands/search.py b/alot/commands/search.py index 2fb32f42..4d794dc8 100644 --- a/alot/commands/search.py +++ b/alot/commands/search.py @@ -9,10 +9,14 @@ from alot import buffers MODE = 'search' -@registerCommand(MODE, 'select', - help='open a new thread buffer') +@registerCommand(MODE, 'select') class OpenThreadCommand(Command): + """open thread in a new buffer""" def __init__(self, thread=None, **kwargs): + """ + :param thread: thread to open (Uses focussed thread if unset) + :type thread: :class:`~alot.db.Thread` + """ self.thread = thread Command.__init__(self, **kwargs) @@ -29,10 +33,16 @@ class OpenThreadCommand(Command): @registerCommand(MODE, 'toggletag', arguments=[ - (['tag'], {'nargs':'+', 'default':'', 'help':'tag to flip'})], - help='toggles tags in selected thread') + (['tag'], {'nargs':'+', 'default':'', 'help':'tag to flip'})]) class ToggleThreadTagCommand(Command): + """toggles given tags in all messages of a thread""" def __init__(self, tag, thread=None, **kwargs): + """ + :param tag: list of tagstrings to flip + :type tag: list of str + :param thread: thread to edit (Uses focussed thread if unset) + :type thread: :class:`~alot.db.Thread` or None + """ assert tag self.thread = thread self.tags = set(tag) @@ -72,10 +82,15 @@ class ToggleThreadTagCommand(Command): @registerCommand(MODE, 'refine', usage='refine query', arguments=[ - (['query'], {'nargs':argparse.REMAINDER, 'help':'search string'})], - help='refine the query of the currently open searchbuffer') + (['query'], {'nargs':argparse.REMAINDER, 'help':'search string'})]) class RefineCommand(Command): + """refine the querystring of this buffer""" def __init__(self, query=None, **kwargs): + """ + :param query: new querystring given as list of strings as returned by + argparse + :type query: list of str + """ self.querystring = ' '.join(query) Command.__init__(self, **kwargs) @@ -92,18 +107,18 @@ class RefineCommand(Command): ui.notify('empty query string') -@registerCommand(MODE, 'refineprompt', - help='prompt to change current search buffers query') +@registerCommand(MODE, 'refineprompt') class RefinePromptCommand(Command): + """prompt to change this buffers querystring""" def apply(self, ui): sbuffer = ui.current_buffer oldquery = sbuffer.querystring ui.apply_command(PromptCommand('refine ' + oldquery)) -@registerCommand(MODE, 'retagprompt', - help='prompt to retag selected threads\' tags') +@registerCommand(MODE, 'retagprompt') class RetagPromptCommand(Command): + """prompt to retag selected threads\' tags""" def apply(self, ui): thread = ui.current_buffer.get_selected_thread() if not thread: @@ -119,10 +134,16 @@ class RetagPromptCommand(Command): @registerCommand(MODE, 'retag', arguments=[ - (['tags'], {'help':'comma separated list of tags'})], - help='overwrite selected thread\'s tags') + (['tags'], {'help':'comma separated list of tags'})]) class RetagCommand(Command): + """overwrite a thread\'s tags""" def __init__(self, tags=u'', thread=None, **kwargs): + """ + :param tags: comma separated list of tagstrings to set + :type tags: str + :param thread: thread to edit (Uses focussed thread if unset) + :type thread: :class:`~alot.db.Thread` or None + """ self.tagsstring = tags self.thread = thread Command.__init__(self, **kwargs) diff --git a/alot/commands/taglist.py b/alot/commands/taglist.py index 8b896fc9..8700dc53 100644 --- a/alot/commands/taglist.py +++ b/alot/commands/taglist.py @@ -4,8 +4,9 @@ from alot.commands.globals import SearchCommand MODE = 'taglist' -@registerCommand(MODE, 'select', help='open search for selected tag') +@registerCommand(MODE, 'select') class TaglistSelectCommand(Command): + """search for messages with selected tag""" def apply(self, ui): tagstring = ui.current_buffer.get_selected_tag() cmd = SearchCommand(query=['tag:"%s"' % tagstring]) |