Hi Igor - and list,
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.
If there are no objections, I'd like to request this change being added
to mainstream.
=====
diff --git a/src/completion/pass.zsh-completion
b/src/completion/pass.zsh-completion
index 27ce15a..5af97df 100644
--- a/src/completion/pass.zsh-completion
+++ b/src/completion/pass.zsh-completion
@@ -17,6 +17,11 @@
# PASSWORD_STORE_DIR=$HOME/work/pass pass $@
# }
+# By default, completed 'directories' within the store will not have a
trailing
+# slash. Furthermore, the offered items will be looked up recursively.
+# To change this, set the 'non-recursive-completion' flag to true as
follows:
+# `zstyle ':completion:*:*:pass:*' non-recursive-completion true`.
+
_pass () {
local cmd
@@ -124,7 +129,12 @@ _pass_complete_entries_helper () {
local IFS=$'\n'
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):-""}
+ zstyle -t ':completion:*:*:pass:*' non-recursive-completion
+ if [ $? -eq 0 ]; then
+ _files -W $prefix -g '*.gpg(:r)'
+ else
+ _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):-""}
+ fi
}
_pass_complete_entries_with_subdirs () {
=====
Best regards,
Wouter
Op 04-07-18 om 16:11 schreef [email protected]:
Hi Wouter,
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.
Thank you.
On Tue, Jul 3, 2018 at 11:05 PM Wouter <[email protected]
<mailto:[email protected]>> wrote:
I see, so what do you think about my patch? If the flag had a
better name that is...
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.
Op 03-07-18 om 22:24 schreef [email protected]
<mailto:[email protected]>:
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.
On Tue 3 Jul 2018, 22:20 Wouter, <[email protected]
<mailto:[email protected]>> wrote:
Op 03-07-18 om 15:57 schreef [email protected]
<mailto:[email protected]>:
> Hi Wouter,
> I also prefer that behavior, I made a copy of _pass and did
this change:
>
> 127c127
> < _files -W $prefix -g '*.gpg(:r)'
> ---
> > _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):-""}
>
> I didn't find more elegant solution.
Hi Igor,
Thank you, I actually like it. It's a rather clean solution
isn't it?
I'd like to make it optional through zstyle so it can be
enabled without
breaking current behaviour. Maybe eventually it could then be
committed
to the repo. Something along the lines of this (although I
had no
inspiration for a proper flag name):
19a20,24
> # By default, completed 'directories' within the store
will not have
a trailing
> # slash. Furthermore, the offered items will be looked up
recursively. To change
> # this, set the 'no_recurse' flag to true as follows:
> # `zstyle ':completion:*:*:pass:*' no_recurse true`.
>
127c132,137
< _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):-""}
---
> zstyle -t ':completion:*:*:pass:*' no_recurse
> if [ $? -eq 0 ]; then
> _files -W $prefix -g '*.gpg(:r)'
> else
> _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):-""}
> fi
Best regards,
Wouter
_______________________________________________
Password-Store mailing list
[email protected]
<mailto:[email protected]>
https://lists.zx2c4.com/mailman/listinfo/password-store
_______________________________________________
Password-Store mailing list
[email protected] <mailto:[email protected]>
https://lists.zx2c4.com/mailman/listinfo/password-store
_______________________________________________
Password-Store mailing list
[email protected]
https://lists.zx2c4.com/mailman/listinfo/password-store