Hi everybody.
I was experimenting a bit with using multiple git repos with pass and
wrote a small patch to allow using a custom prefix for pass aliases.
With this, you can do
workpass() {
PASSWORD_STORE_DIR=$HOME/work/pass pass $@
}
compdef _pass workpass
zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
in your .zshrc and have the correct completion.
Regards
Benjamin
>From bafb68c459cb4b5952aec9c63ef9b1f332b2ebf4 Mon Sep 17 00:00:00 2001
From: Benjamin Richter <[email protected]>
Date: Fri, 25 Sep 2015 16:48:21 +0200
Subject: [PATCH] allow custom prefix in zsh completion
---
src/completion/pass.zsh-completion | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/completion/pass.zsh-completion b/src/completion/pass.zsh-completion
index 9bb3f97..fc5f921 100644
--- a/src/completion/pass.zsh-completion
+++ b/src/completion/pass.zsh-completion
@@ -113,7 +113,8 @@ _pass_cmd_show () {
}
_pass_complete_entries_helper () {
local IFS=$'\n'
- local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
+ local prefix
+ zstyle -s ":completion:${curcontext}:" prefix prefix || prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
_values -C 'passwords' ${$(find -L "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print 2>/dev/null | sed -e "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' | sort):-""}
}
--
2.5.3
_______________________________________________
Password-Store mailing list
[email protected]
http://lists.zx2c4.com/mailman/listinfo/password-store