From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 956886DE0C97 for ; Wed, 9 Aug 2017 00:14:48 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.053 X-Spam-Level: X-Spam-Status: No, score=-0.053 tagged_above=-999 required=5 tests=[AWL=-0.053] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3do9kZ5VF2Z7 for ; Wed, 9 Aug 2017 00:14:48 -0700 (PDT) Received: from che.mayfirst.org (che.mayfirst.org [162.247.75.118]) by arlo.cworth.org (Postfix) with ESMTP id D3C536DE0C6D for ; Wed, 9 Aug 2017 00:14:47 -0700 (PDT) Received: from fifthhorseman.net (ool-6c3a0662.static.optonline.net [108.58.6.98]) by che.mayfirst.org (Postfix) with ESMTPSA id 85436F99A for ; Wed, 9 Aug 2017 03:14:45 -0400 (EDT) Received: by fifthhorseman.net (Postfix, from userid 1000) id BA414208B5; Wed, 9 Aug 2017 03:14:41 -0400 (EDT) From: Daniel Kahn Gillmor To: Notmuch Mail Subject: [PATCH] completion: add bash completion for "notmuch reindex" Date: Wed, 9 Aug 2017 03:14:41 -0400 Message-Id: <20170809071441.32708-1-dkg@fifthhorseman.net> X-Mailer: git-send-email 2.13.2 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2017 07:14:48 -0000 The main thing that notmuch reindex does is to use search terms, so we can reuse a bunch of the existing completion framework. --- completion/notmuch-completion.bash | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash index dd0ec275..440ee3cd 100644 --- a/completion/notmuch-completion.bash +++ b/completion/notmuch-completion.bash @@ -417,6 +417,24 @@ _notmuch_search() esac } +_notmuch_reindex() +{ + local cur prev words cword split + _init_completion -s || return + + ! $split && + case "${cur}" in + -*) + local options="${_notmuch_shared_options}" + compopt -o nospace + COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) + ;; + *) + _notmuch_search_terms + ;; + esac +} + _notmuch_address() { local cur prev words cword split @@ -532,7 +550,7 @@ _notmuch_tag() _notmuch() { - local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag emacs-mua" + local _notmuch_commands="compact config count dump help insert new reply restore reindex search address setup show tag emacs-mua" local arg cur prev words cword split # require bash-completion with _init_completion -- 2.13.2