]> git.notmuchmail.org Git - notmuch/blobdiff - completion/notmuch-completion.bash
completion: complete directory parameters to directories only
[notmuch] / completion / notmuch-completion.bash
index 04324bbb3968222d84af224089a69c59e08a407b..d88c5e7d965e96b191040fd982b71d170a8b7f71 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}) )
            ;;
@@ -67,7 +78,7 @@ _notmuch_compact()
     $split &&
     case "${prev}" in
        --backup)
-           _filedir
+           _filedir -d
            return
            ;;
     esac
@@ -96,7 +107,7 @@ _notmuch_config()
            ;;
        # these will also complete on config get, but we don't care
        database.path)
-           _filedir
+           _filedir -d
            ;;
        maildir.synchronize_flags)
            COMPREPLY=( $(compgen -W "true false" -- ${cur}) )
@@ -208,7 +219,7 @@ _notmuch_new()
 
     case "${cur}" in
        -*)
-           local options="--no-hooks"
+           local options="--no-hooks --quiet"
            COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )
            ;;
     esac