[PATCH v2] completion: complete notmuch insert --folder to maildir folders only

Jani Nikula jani at nikula.org
Thu Jan 1 06:34:30 PST 2015


The --folder option expects a folder relative from maildir root, so
complete like the folder: search term.
---
 completion/notmuch-completion.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
index 386437333742..d58dc8bed60f 100644
--- a/completion/notmuch-completion.bash
+++ b/completion/notmuch-completion.bash
@@ -188,7 +188,10 @@ _notmuch_insert()
     $split &&
     case "${prev}" in
 	--folder)
-	    _filedir
+	    local path=`notmuch config get database.path`
+	    compopt -o nospace
+	    COMPREPLY=( $(compgen -d "$path/${cur}" | \
+		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
 	    return
 	    ;;
     esac
-- 
2.1.4



More information about the notmuch mailing list