[pass] [PATCH 1/2] bashcomp: PASSWORD_STORE_DIR env var does not necessarily have a trailing slash

samuel.lethiec at intelunix.fr samuel.lethiec at intelunix.fr
Sun Mar 1 22:23:12 CET 2015


Hello,

If PASSWORD_STORE_DIR does not end with a slash, bash completion is 
somewhat messed up:

$ pass[TAB]
//        edit      generate  grep...

Here is a short patch which fixes it.

PS: hope my git foo is good enough:)
---
  src/completion/pass.bash-completion | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/src/completion/pass.bash-completion 
b/src/completion/pass.bash-completion
index ea31fbf..efd4b70 100644
--- a/src/completion/pass.bash-completion
+++ b/src/completion/pass.bash-completion
@@ -6,6 +6,7 @@

  _pass_complete_entries () {
         prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+       prefix="${prefix%/}/"
         suffix=".gpg"
         autoexpand=${1:-0}

@@ -42,6 +43,7 @@ _pass_complete_entries () {

  _pass_complete_folders () {
         prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store/}"
+       prefix="${prefix%/}/"

         local IFS=$'\n'
         local items=($(compgen -d $prefix$cur))




More information about the Password-Store mailing list