zsh completion: enhance store navigation
Wouter
info at lsof.nl
Tue Jul 3 22:18:52 CEST 2018
Op 03-07-18 om 15:57 schreef yanchenko.igor at gmail.com:
> 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
More information about the Password-Store
mailing list