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

Jani Nikula jani at nikula.org
Mon Nov 10 11:35:43 PST 2014


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..a756b22339cb 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##folder:}" | \
+		sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
 	    return
 	    ;;
     esac
-- 
2.1.1



More information about the notmuch mailing list