Skip to content
Snippets Groups Projects
Commit a6129c9e authored by Jason A. Donenfeld's avatar Jason A. Donenfeld
Browse files

Import ZSH completion file from Johan Venant <jvenant@invicem.pro>.

parent a1788f20
No related branches found
No related tags found
No related merge requests found
...@@ -13,7 +13,9 @@ install: ...@@ -13,7 +13,9 @@ install:
@mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(SYSCONFDIR)/bash_completion.d @mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 $(DESTDIR)$(SYSCONFDIR)/bash_completion.d
@install -m 0755 -v src/password-store.sh $(DESTDIR)$(BINDIR)/pass @install -m 0755 -v src/password-store.sh $(DESTDIR)$(BINDIR)/pass
@install -m 0644 -v man/pass.1 $(DESTDIR)$(MANDIR)/man1/pass.1 @install -m 0644 -v man/pass.1 $(DESTDIR)$(MANDIR)/man1/pass.1
@install -m 0644 -v bash-completion/pass-bash-completion.sh $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/password-store @install -m 0644 -v bash-completion/pass-bash-completion $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/password-store
# Uncomment to install the zsh completion file too.
# @install -m 0644 -v bash-completion/pass-zsh/completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_pass
uninstall: uninstall:
@rm -vf $(DESTDIR)$(BINDIR)/pass $(DESTDIR)$(MANDIR)/man1/pass.1 $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/password-store @rm -vf $(DESTDIR)$(BINDIR)/pass $(DESTDIR)$(MANDIR)/man1/pass.1 $(DESTDIR)$(SYSCONFDIR)/bash_completion.d/password-store
#compdef pass
# This file is under the GPLv2+ license.
# Heavily based on http://zsh.sf.net/Guide/zshguide06.html#l177
# And Frédéric Perrin article http://tar-jx.bz/notes/zsh-completion.html
# Johan Venant, September 2012
_pass () {
local cmd
if (( CURRENT > 2)); then
cmd=${words[2]}
# Set the context for the subcommand.
curcontext="${curcontext%:*:*}:pass-$cmd"
# Narrow the range of words we are looking at to exclude `pass'
(( CURRENT-- ))
shift words
# Run the completion for the subcommand
(( $+functions[_pass_cmd_$cmd] )) && _pass_cmd_$cmd
else
_values : \
"init[Initialize new password storage]" \
"ls[subfolder List names of passwords]" \
"show[Decrypt and print a password]" \
"insert[Insert a new password]" \
"generate[Generate a new password using pwgen]" \
"rm[Remove the password]" \
"push[push the latest changes using git-push(1)]" \
"pull[pull the latest changes using git-pull(1)]" \
"git[Call git]" \
"help[Help]"
fi
}
_pass_cmd_init () {
}
_pass_cmd_ls () {
_arguments : \
'::ls:_get_stored_pwd'
}
_pass_cmd_show () {
_arguments : \
"-c[put it on the clipboard]" \
'*::show:_get_stored_pwd'
#'::pass id:_files -W ~/.password-store -g "*.gpg(|.*)(-.)"'
}
_pass_cmd_insert () {
_arguments : \
"-n[no console output]" \
"-m[multiline]" \
'::show:_get_stored_pwd'
}
_pass_cmd_generate () {
_arguments : \
"-n[no symbols]" \
"-c[put password on the clipboard]" \
'::show:_get_stored_pwd'
}
_pass_cmd_rm () {
_arguments : \
'::ls:_get_stored_pwd'
}
_get_stored_pwd () {
compadd `find ~/.password-store \( -name .git -o -name .gpg-id \) -prune -o -print | sed 's#.*/.password-store/\?##' | sed 's#\.gpg##' | sort`
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment