From: Tomi Ollila Date: Thu, 7 Nov 2013 13:30:10 +0000 (+0200) Subject: Re: [PATCH] completion: update bash completion X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7772b2f38f25aa82a32b25430919fc60d1f99f2c;p=notmuch-archives.git Re: [PATCH] completion: update bash completion --- diff --git a/33/2d537ff738ae5dd9546b9982c4c5b9ce8cf565 b/33/2d537ff738ae5dd9546b9982c4c5b9ce8cf565 new file mode 100644 index 000000000..edbebc777 --- /dev/null +++ b/33/2d537ff738ae5dd9546b9982c4c5b9ce8cf565 @@ -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 19C2B431FBD + for ; Thu, 7 Nov 2013 05:30:23 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 mxKTJLGo4FJi for ; + Thu, 7 Nov 2013 05:30:15 -0800 (PST) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 44171431FAE + for ; Thu, 7 Nov 2013 05:30:15 -0800 (PST) +Received: from guru.guru-group.fi (localhost [IPv6:::1]) + by guru.guru-group.fi (Postfix) with ESMTP id C095D100051; + Thu, 7 Nov 2013 15:30:10 +0200 (EET) +From: Tomi Ollila +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH] completion: update bash completion +In-Reply-To: <1383765937-20921-1-git-send-email-jani@nikula.org> +References: <1383765937-20921-1-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.16+119~g219c55f (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-unknown-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain +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: Thu, 07 Nov 2013 13:30:23 -0000 + +On Wed, Nov 06 2013, Jani Nikula wrote: + +> 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 + +These changes looks sensible and consistent to me. +1 + +Tomi + + +> +> --- +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch