Skip to content

Commit

Permalink
Merge pull request #1618 from guludo/nx/select-all-folded
Browse files Browse the repository at this point in the history
commands/search: Add option --all-folded to select
  • Loading branch information
lucc authored Jan 2, 2024
2 parents 2c5dc0d + 280b7cb commit 0ba39cc
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions alot/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,24 @@
MODE = 'search'


@registerCommand(MODE, 'select')
@registerCommand(
MODE, 'select',
arguments=[
(['--all-folded'], {'action': 'store_true',
'dest': 'all_folded',
'help': 'do not unfold matching messages'}),
],
)
class OpenThreadCommand(Command):

"""open thread in a new buffer"""
def __init__(self, thread=None, **kwargs):
def __init__(self, thread=None, all_folded=False, **kwargs):
"""
:param thread: thread to open (Uses focussed thread if unset)
:type thread: :class:`~alot.db.Thread`
"""
self.thread = thread
self.all_folded = all_folded
Command.__init__(self, **kwargs)

def apply(self, ui):
Expand All @@ -40,7 +48,8 @@ def apply(self, ui):

tb = buffers.ThreadBuffer(ui, self.thread)
ui.buffer_open(tb)
tb.unfold_matching(query)
if not self.all_folded:
tb.unfold_matching(query)


@registerCommand(MODE, 'refine', help='refine query', arguments=[
Expand Down

0 comments on commit 0ba39cc

Please sign in to comment.