[pass] Completions for aliases (zsh)

Kevin Lyda kevin at ie.suberic.net
Fri Jul 4 23:16:26 CEST 2014


Perhaps everyone already knows this, but I couldn't find it anywhere.
The nice folks on #zsh helped me (aka allowed me to remain ignorant of
zsh completion syntax) so thought I'd share it here.

Say you use pass for home and work.  Home is just the pass command and
those credentials live in the default place.  Completions work great.
You've aliased wpass to "PASSWORD_STORE_DIR=$HOME/.password-store-work
pass" but completions don't work.

Here's how you fix this. Step one is to remove the alias - this will
need wpass to be a function. Once you do that, do this (this would
likely go in you ~/.zshrc):

wpass() {
  PASSWORD_STORE_DIR=$HOME/.password-store-work pass
}
compdef -e 'PASSWORD_STORE_DIR=$HOME/.password-store-work _pass' wpass

Hope this helps,

Kevin

-- 
Kevin Lyda
Galway, Ireland
US Citizen overseas? We can vote.
Register now: http://www.votefromabroad.org/


More information about the Password-Store mailing list