completion: add bash completion for query: and property:
authorJani Nikula <jani@nikula.org>
Sat, 17 Dec 2016 10:50:49 +0000 (12:50 +0200)
committerDavid Bremner <david@tethera.net>
Sun, 26 Feb 2017 11:57:42 +0000 (07:57 -0400)
Add prefix completion for query and property, with value completion
for query. Apparently there's no way to get at the available
properties in the cli.

completion/notmuch-completion.bash

index d44b2a2811f016ce052296f61a8c12bbc77cf3d8..7cad047f8499b083640c8a968551c09e9246c094 100644 (file)
@@ -117,8 +117,12 @@ _notmuch_search_terms()
            compopt -o nospace
            COMPREPLY=( $(compgen -P "mimetype:" -W "`_notmuch_mimetype ${cur}`" -- ${cur##mimetype:}) )
            ;;
+       query:*)
+           compopt -o nospace
+           COMPREPLY=( $(compgen -P "query:" -W "`notmuch config list | sed -n '/^query\./s/^query\.\([^=]*\)=.*/\1/p'`" -- ${cur##query:}) )
+           ;;
        *)
-           local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date: lastmod:"
+           local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date: lastmod: query: property:"
            compopt -o nospace
            COMPREPLY=( $(compgen -W "${search_terms}" -- ${cur}) )
            ;;