From f2f078a1bbbce1631a99150029541544e621b6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 9 Aug 2018 20:17:43 +0200 Subject: [PATCH] pass: update completion (2018-08-03) --- plugins/pass/_pass | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/pass/_pass b/plugins/pass/_pass index 715229e76..5f3b8f541 100644 --- a/plugins/pass/_pass +++ b/plugins/pass/_pass @@ -6,11 +6,17 @@ # Brian Mattern # Jason A. Donenfeld . # All Rights Reserved. -# # This file is licensed under the GPLv2+. # Please visit https://git.zx2c4.com/password-store/tree/COPYING for more information. + + +# If you use multiple repositories, you can configure completion like this: # -# Oh my zsh plugin maintainer: Santiago Borrazás +# compdef _pass workpass +# zstyle ':completion::complete:workpass::' prefix "$HOME/work/pass" +# workpass() { +# PASSWORD_STORE_DIR=$HOME/work/pass pass $@ +# } _pass () { @@ -117,8 +123,9 @@ _pass_cmd_show () { } _pass_complete_entries_helper () { local IFS=$'\n' - local 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):-""} + 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##' -e 's#\\#\\\\#' | sort):-""} } _pass_complete_entries_with_subdirs () {