]> git.notmuchmail.org Git - notmuch/commitdiff
completion: add proper completion of folder: and path:
authorJani Nikula <jani@nikula.org>
Wed, 12 Mar 2014 20:33:48 +0000 (22:33 +0200)
committerDavid Bremner <david@tethera.net>
Tue, 25 Mar 2014 23:00:13 +0000 (20:00 -0300)
Complete folder: to maildir folders and path: to directories in mail
store.

completion/notmuch-completion.bash

index 0f132043dea5e89219f6853714b63c74ac101476..59f1a3ea643123ccb2ef7fe2034dac28ae8f3dc2 100644 (file)
@@ -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}) )
            ;;