Re: [PATCH 1/2] completion: add proper completion of folder: and path:

Subject: Re: [PATCH 1/2] completion: add proper completion of folder: and path:

Date: Mon, 24 Mar 2014 23:14:14 +0200

To: Jani Nikula, notmuch@notmuchmail.org

Cc:

From: Tomi Ollila


On Wed, Mar 12 2014, Jani Nikula <jani@nikula.org> wrote:

> Complete folder: to maildir folders and path: to directories in mail
> store.
> ---

Series LGTM.


Tomi


COMPREPLY=( $(cd $path; compgen -d "${cur#path:}") ) might also work but...

>  completion/notmuch-completion.bash | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
> index 0f132043dea5..59f1a3ea6431 100644
> --- a/completion/notmuch-completion.bash
> +++ b/completion/notmuch-completion.bash
> @@ -49,8 +49,19 @@ _notmuch_search_terms()
>  	from:*)
>  	    COMPREPLY=( $(compgen -P "from:" -W "`_notmuch_user_emails`" -- ${cur##from:}) )
>  	    ;;
> +	path:*)
> +	    local path=`notmuch config get database.path`
> +	    compopt -o nospace
> +	    COMPREPLY=( $(compgen -d "$path/${cur##path:}" | sed "s|^$path/||" ) )
> +	    ;;
> +	folder:*)
> +	    local path=`notmuch config get database.path`
> +	    compopt -o nospace
> +	    COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
> +		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
> +	    ;;
>  	*)
> -	    local search_terms="from: to: subject: attachment: tag: id: thread: folder: date:"
> +	    local search_terms="from: to: subject: attachment: tag: id: thread: folder: path: date:"
>  	    compopt -o nospace
>  	    COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) )
>  	    ;;
> -- 
> 1.9.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: