<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi Igor - and list,</p>
<p>Here's a new (properly formatted) patch. The parameter name is
now 'non-recursive-completion' which is slightly more descriptive
and also more compliant with zsh.</p>
<p>If there are no objections, I'd like to request this change being
added to mainstream.<br>
</p>
<p>=====<br>
diff --git a/src/completion/pass.zsh-completion
b/src/completion/pass.zsh-completion<br>
index 27ce15a..5af97df 100644<br>
--- a/src/completion/pass.zsh-completion<br>
+++ b/src/completion/pass.zsh-completion<br>
@@ -17,6 +17,11 @@<br>
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@<br>
# }<br>
<br>
+# By default, completed 'directories' within the store will not
have a trailing<br>
+# slash. Furthermore, the offered items will be looked up
recursively.<br>
+# To change this, set the 'non-recursive-completion' flag to true
as follows:<br>
+# `zstyle ':completion:*:*:pass:*' non-recursive-completion
true`.<br>
+<br>
<br>
_pass () {<br>
local cmd<br>
@@ -124,7 +129,12 @@ _pass_complete_entries_helper () {<br>
local IFS=$'\n'<br>
local prefix<br>
zstyle -s ":completion:${curcontext}:" prefix prefix ||
prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"<br>
- _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):-""}<br>
+ zstyle -t ':completion:*:*:pass:*' non-recursive-completion<br>
+ if [ $? -eq 0 ]; then<br>
+ _files -W $prefix -g '*.gpg(:r)'<br>
+ else<br>
+ _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):-""}<br>
+ fi<br>
}<br>
<br>
_pass_complete_entries_with_subdirs () {<br>
=====</p>
<p>Best regards,<br>
Wouter<br>
</p>
<br>
<div class="moz-cite-prefix">Op 04-07-18 om 16:11 schreef
<a class="moz-txt-link-abbreviated" href="mailto:yanchenko.igor@gmail.com">yanchenko.igor@gmail.com</a>:<br>
</div>
<blockquote type="cite"
cite="mid:CAL47JuJ9tgYFeT-dSkBDNVA79ys9jZQRp-JqeNvEU_wZ3A2kjw@mail.gmail.com">
<div dir="ltr">
<div>Hi Wouter,</div>
<div><br>
</div>
<div>I just managed to test your patch, it works as a charm for
me, I would ask to include it to mainstream, if there no other
suggestion the option name.</div>
<div><br>
</div>
<div>Thank you.<br>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, Jul 3, 2018 at 11:05 PM Wouter <<a
href="mailto:info@lsof.nl" moz-do-not-send="true">info@lsof.nl</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<p>I see, so what do you think about my patch? If the flag
had a better name that is...</p>
<p>I do not really like how one flag causes two changes in
behaviour, but if the name reflects that (e.g.
'alternative_completion') it might be okay.<br>
</p>
<br>
<div class="m_4929652953748196526moz-cite-prefix">Op
03-07-18 om 22:24 schreef <a
class="m_4929652953748196526moz-txt-link-abbreviated"
href="mailto:yanchenko.igor@gmail.com" target="_blank"
moz-do-not-send="true">yanchenko.igor@gmail.com</a>:<br>
</div>
</div>
<div text="#000000" bgcolor="#FFFFFF">
<blockquote type="cite">I wanted to make a solution that I
can manage by flags, not by having a separate _pass file,
that's what I mean by elegant solution. <br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue 3 Jul 2018, 22:20 Wouter, <<a
href="mailto:info@lsof.nl" target="_blank"
moz-do-not-send="true">info@lsof.nl</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Op
03-07-18 om 15:57 schreef <a
href="mailto:yanchenko.igor@gmail.com"
target="_blank" moz-do-not-send="true">yanchenko.igor@gmail.com</a>:<br>
> Hi Wouter,<br>
> I also prefer that behavior, I made a copy of
_pass and did this change:<br>
><br>
> 127c127<br>
> < _files -W $prefix -g '*.gpg(:r)'<br>
> ---<br>
> > _values -C 'passwords' ${$(find -L
"$prefix" \( -name .git -o <br>
> -name .gpg-id \) -prune -o $@ -print
2>/dev/null | sed -e <br>
> "s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e
's#\\#\\\\#' | sort):-""}<br>
><br>
> I didn't find more elegant solution.<br>
Hi Igor,<br>
<br>
Thank you, I actually like it. It's a rather clean
solution isn't it?<br>
<br>
I'd like to make it optional through zstyle so it can
be enabled without <br>
breaking current behaviour. Maybe eventually it could
then be committed <br>
to the repo. Something along the lines of this
(although I had no <br>
inspiration for a proper flag name):<br>
<br>
19a20,24<br>
> # By default, completed 'directories' within the
store will not have <br>
a trailing<br>
> # slash. Furthermore, the offered items will be
looked up <br>
recursively. To change<br>
> # this, set the 'no_recurse' flag to true as
follows:<br>
> # `zstyle ':completion:*:*:pass:*' no_recurse
true`.<br>
><br>
127c132,137<br>
< _values -C 'passwords' ${$(find -L "$prefix"
\( -name .git -o <br>
-name .gpg-id \) -prune -o $@ -print 2>/dev/null |
sed -e <br>
"s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#'
| sort):-""}<br>
---<br>
> zstyle -t ':completion:*:*:pass:*'
no_recurse<br>
> if [ $? -eq 0 ]; then<br>
> _files -W $prefix -g '*.gpg(:r)'<br>
> else<br>
> _values -C 'passwords' ${$(find -L
"$prefix" \( -name .git -o <br>
-name .gpg-id \) -prune -o $@ -print 2>/dev/null |
sed -e <br>
"s#${prefix}/\{0,1\}##" -e 's#\.gpg##' -e 's#\\#\\\\#'
| sort):-""}<br>
> fi<br>
<br>
Best regards,<br>
Wouter<br>
_______________________________________________<br>
Password-Store mailing list<br>
<a href="mailto:Password-Store@lists.zx2c4.com"
target="_blank" moz-do-not-send="true">Password-Store@lists.zx2c4.com</a><br>
<a
href="https://lists.zx2c4.com/mailman/listinfo/password-store"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.zx2c4.com/mailman/listinfo/password-store</a><br>
</blockquote>
</div>
</blockquote>
<br>
</div>
_______________________________________________<br>
Password-Store mailing list<br>
<a href="mailto:Password-Store@lists.zx2c4.com"
target="_blank" moz-do-not-send="true">Password-Store@lists.zx2c4.com</a><br>
<a
href="https://lists.zx2c4.com/mailman/listinfo/password-store"
rel="noreferrer" target="_blank" moz-do-not-send="true">https://lists.zx2c4.com/mailman/listinfo/password-store</a><br>
</blockquote>
</div>
</blockquote>
<br>
</body>
</html>