Fix completion to allow for multiple pass repos

- see upstream:
   https://git.zx2c4.com/password-store/tree/src/completion/pass.zsh-completion
This commit is contained in:
Sven Hergenhahn 2017-12-07 16:17:58 +01:00
parent 2af2d1aa31
commit b11f891484

View File

@ -6,12 +6,19 @@
# Brian Mattern <rephorm@rephorm.com> # Brian Mattern <rephorm@rephorm.com>
# Jason A. Donenfeld <Jason@zx2c4.com>. # Jason A. Donenfeld <Jason@zx2c4.com>.
# All Rights Reserved. # All Rights Reserved.
#
# This file is licensed under the GPLv2+. # This file is licensed under the GPLv2+.
# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information. # Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information.
# #
# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com> # Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com>
# If you use multiple repositories, you can configure completion like this:
#
# compdef _pass workpass
# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass"
# workpass() {
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
# }
_pass () { _pass () {
local cmd local cmd
@ -117,8 +124,9 @@ _pass_cmd_show () {
} }
_pass_complete_entries_helper () { _pass_complete_entries_helper () {
local IFS=$'\n' local IFS=$'\n'
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}" local prefix
_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):-""} 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##' -e 's#\\#\\\\#' | sort):-""}
} }
_pass_complete_entries_with_subdirs () { _pass_complete_entries_with_subdirs () {