From eea02177b051795956eb1024896dc9d6a47bca9a Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 6 Nov 2013 21:25:37 +0200 Subject: [PATCH] [PATCH] completion: update bash completion --- ae/be209849ad827231f137fdc2886529447c3ef1 | 244 ++++++++++++++++++++++ 1 file changed, 244 insertions(+) create mode 100644 ae/be209849ad827231f137fdc2886529447c3ef1 diff --git a/ae/be209849ad827231f137fdc2886529447c3ef1 b/ae/be209849ad827231f137fdc2886529447c3ef1 new file mode 100644 index 000000000..2f77d1d33 --- /dev/null +++ b/ae/be209849ad827231f137fdc2886529447c3ef1 @@ -0,0 +1,244 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 155CB429E5D + for ; Wed, 6 Nov 2013 11:25:51 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id gCHgtYEtBnue for ; + Wed, 6 Nov 2013 11:25:43 -0800 (PST) +Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com + [74.125.83.54]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 065B9429E53 for ; Wed, 6 Nov 2013 11:25:42 -0800 + (PST) +Received: by mail-ee0-f54.google.com with SMTP id c50so2814647eek.27 + for ; Wed, 06 Nov 2013 11:25:40 -0800 (PST) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=7yytpoFUW5268d4CkCKPbbHnxEdNqpqBym4GWu4zmJ4=; + b=BloeKAJlea/HavyLcZpoL51PqvpGin6gKC0LM01jmXvW4l78cCXYipShKtf8HPyExY + u2/XUov5iRkVJoGcYpif3cUawdsDi0TRsefVBL2wBPVWm6OjukRPC3uP3L3ATXDOWDpF + 9PWdNZyR8hVma81fjOKaFw2UJ+ksG/dVY+jG/+Kp2jkGiBIkQDOao0Ixo92Xs/L2x3pB + +7bCxeTYC/dOh1+ngC1S47yIbRSklixfBEhsyIYM9M2cxisf8U1y45h5srG5g7A1Gfyj + BT8pgI5IRC+KQWcMdIQYHrP6j3jJdm+MuO+hideu6poUwrQ+trW70cxJSXkyfdkl0h2S + igCQ== +X-Gm-Message-State: + ALoCoQkibZRMv3CT2VfJRn5n4Ky14u4et7928p9PUlUe59PNjnRpje+4AobQ8v0jjNEQ0kWEl4up +X-Received: by 10.14.178.67 with SMTP id e43mr5496082eem.59.1383765940374; + Wed, 06 Nov 2013 11:25:40 -0800 (PST) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + u46sm77813724eep.17.2013.11.06.11.25.38 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 06 Nov 2013 11:25:39 -0800 (PST) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH] completion: update bash completion +Date: Wed, 6 Nov 2013 21:25:37 +0200 +Message-Id: <1383765937-20921-1-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.8.4.rc3 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +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, 06 Nov 2013 19:25:51 -0000 + +Update bash completion to cover new commands and options: + +notmuch compact --quiet --backup=DIR +notmuch count --output=files --batch --input=FILE +notmuch insert --folder=DIR --create-folder +notmuch search --exclude=all --duplicate=N +notmuch show --include-html +notmuch tag --batch --input=FILE --remove-all + +--- + +This logically depends on id:cover.1383481295.git.jani@nikula.org +which adds --quiet and --backup=DIR parameters to compact. +--- + completion/notmuch-completion.bash | 89 +++++++++++++++++++++++++++++++++++--- + 1 file changed, 82 insertions(+), 7 deletions(-) + +diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash +index 7bd7745..04324bb 100644 +--- a/completion/notmuch-completion.bash ++++ b/completion/notmuch-completion.bash +@@ -59,6 +59,29 @@ _notmuch_search_terms() + __ltrim_colon_completions "${cur}" + } + ++_notmuch_compact() ++{ ++ local cur prev words cword split ++ _init_completion -s || return ++ ++ $split && ++ case "${prev}" in ++ --backup) ++ _filedir ++ return ++ ;; ++ esac ++ ++ ! $split && ++ case "${cur}" in ++ -*) ++ local options="--backup= --quiet" ++ compopt -o nospace ++ COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) ++ ;; ++ esac ++} ++ + _notmuch_config() + { + local cur prev words cword split +@@ -89,19 +112,23 @@ _notmuch_count() + $split && + case "${prev}" in + --output) +- COMPREPLY=( $( compgen -W "messages threads" -- "${cur}" ) ) ++ COMPREPLY=( $( compgen -W "messages threads files" -- "${cur}" ) ) + return + ;; + --exclude) + COMPREPLY=( $( compgen -W "true false" -- "${cur}" ) ) + return + ;; ++ --input) ++ _filedir ++ return ++ ;; + esac + + ! $split && + case "${cur}" in + -*) +- local options="--output= --exclude=" ++ local options="--output= --exclude= --batch --input=" + compopt -o nospace + COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) + ;; +@@ -141,6 +168,39 @@ _notmuch_dump() + esac + } + ++_notmuch_insert() ++{ ++ local cur prev words cword split ++ # handle tags with colons and equal signs ++ _init_completion -s -n := || return ++ ++ $split && ++ case "${prev}" in ++ --folder) ++ _filedir ++ return ++ ;; ++ esac ++ ++ ! $split && ++ case "${cur}" in ++ --*) ++ local options="--create-folder --folder=" ++ compopt -o nospace ++ COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) ++ return ++ ;; ++ +*) ++ COMPREPLY=( $(compgen -P "+" -W "`notmuch search --output=tags \*`" -- ${cur##+}) ) ++ ;; ++ -*) ++ COMPREPLY=( $(compgen -P "-" -W "`notmuch search --output=tags \*`" -- ${cur##-}) ) ++ ;; ++ esac ++ # handle tags with colons ++ __ltrim_colon_completions "${cur}" ++} ++ + _notmuch_new() + { + local cur prev words cword split +@@ -231,7 +291,7 @@ _notmuch_search() + return + ;; + --exclude) +- COMPREPLY=( $( compgen -W "true false flag" -- "${cur}" ) ) ++ COMPREPLY=( $( compgen -W "true false flag all" -- "${cur}" ) ) + return + ;; + esac +@@ -239,7 +299,7 @@ _notmuch_search() + ! $split && + case "${cur}" in + -*) +- local options="--format= --output= --sort= --offset= --limit= --exclude=" ++ local options="--format= --output= --sort= --offset= --limit= --exclude= --duplicate=" + compopt -o nospace + COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) + ;; +@@ -273,7 +333,7 @@ _notmuch_show() + ! $split && + case "${cur}" in + -*) +- local options="--entire-thread= --format= --exclude= --body= --format-version= --part= --verify --decrypt" ++ local options="--entire-thread= --format= --exclude= --body= --format-version= --part= --verify --decrypt --include-html" + compopt -o nospace + COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) + ;; +@@ -287,9 +347,24 @@ _notmuch_tag() + { + local cur prev words cword split + # handle tags with colons and equal signs +- _init_completion -n := || return ++ _init_completion -s -n := || return ++ ++ $split && ++ case "${prev}" in ++ --input) ++ _filedir ++ return ++ ;; ++ esac + ++ ! $split && + case "${cur}" in ++ --*) ++ local options="--batch --input= --remove-all" ++ compopt -o nospace ++ COMPREPLY=( $(compgen -W "$options" -- ${cur}) ) ++ return ++ ;; + +*) + COMPREPLY=( $(compgen -P "+" -W "`notmuch search --output=tags \*`" -- ${cur##+}) ) + ;; +@@ -307,7 +382,7 @@ _notmuch_tag() + + _notmuch() + { +- local _notmuch_commands="config count dump help new reply restore search setup show tag" ++ local _notmuch_commands="compact config count dump help insert new reply restore search setup show tag" + local arg cur prev words cword split + _init_completion || return + +-- +1.8.4.rc3 + -- 2.26.2