.bin
.config
.local
.ncmpcpp
.oh-my-zsh
lib
plugins
adb
ant
apache2-macports
arcanist
archlinux
asdf
autoenv
autojump
autopep8
aws
battery
bbedit
bgnotify
boot2docker
bower
branch
brew
bundler
bwana
cabal
cake
cakephp3
capistrano
cargo
cask
catimg
celery
chruby
chucknorris
cloudapp
codeclimate
coffee
colemak
colored-man-pages
colorize
command-not-found
common-aliases
compleat
composer
copybuffer
copydir
copyfile
cp
cpanm
debian
dircycle
dirhistory
dirpersist
django
dnf
docker
docker-compose
dotenv
droplr
emacs
ember-cli
emoji
emoji-clock
emotty
encode64
extract
fabric
fancy-ctrl-z
fasd
fastfile
fbterm
fedora
firewalld
forklift
fossil
frontend-search
gas
gb
geeknote
gem
git
git-extras
git-flow
git-flow-avh
git-hubflow
git-prompt
git-remote-branch
gitfast
github
gitignore
glassfish
globalias
gnu-utils
go
golang
gpg-agent
gradle
grails
grunt
gulp
heroku
history
history-substring-search
httpie
iwhois
jake-node
jhbuild
jira
jruby
jsontools
jump
kate
kitchen
knife
knife_ssh
kubectl
laravel
laravel4
laravel5
last-working-dir
lein
lighthouse
lol
macports
man
marked2
mercurial
meteor
mix
mix-fast
mosh
mvn
mysql-macports
n98-magerun
nanoc
ng
nmap
node
nomad
npm
nvm
nyan
osx
pass
_pass
paver
pep8
per-directory-history
perl
perms
phing
pip
pj
pod
postgres
pow
powder
powify
profiles
pyenv
pylint
python
rails
rake
rake-fast
rand-quote
rbenv
rbfu
react-native
rebar
redis-cli
repo
rsync
ruby
rust
rvm
safe-paste
sbt
scala
scd
screen
scw
sfffe
shrink-path
singlechar
spring
sprunge
ssh-agent
stack
sublime
sudo
supervisor
suse
svn
svn-fast-info
swiftpm
symfony
symfony2
systemadmin
systemd
taskwarrior
terminalapp
terminitor
terraform
textastic
textmate
thefuck
themes
thor
tig
tmux
tmux-cssh
tmuxinator
torrent
tugboat
ubuntu
urltools
vagrant
vault
vi-mode
vim-interaction
virtualenv
virtualenvwrapper
vundle
wakeonlan
wd
web-search
wp-cli
xcode
yarn
yii
yii2
yum
z
zeus
zsh-navigation-tools
zsh_reload
templates
themes
tools
CONTRIBUTING.md
LICENSE.txt
README.md
oh-my-zsh.sh
.themes
.vim
.Xdefaults
.Xresources
.bash_profile
.bashrc
.profile
.vimrc
.xinitrc
.xsessionrc
.zshrc
README.md
139 lines
3.7 KiB
Plaintext
139 lines
3.7 KiB
Plaintext
#compdef pass
|
|
#autoload
|
|
|
|
# Copyright (C) 2012 - 2014:
|
|
# Johan Venant <jvenant@invicem.pro>
|
|
# Brian Mattern <rephorm@rephorm.com>
|
|
# Jason A. Donenfeld <Jason@zx2c4.com>.
|
|
# All Rights Reserved.
|
|
#
|
|
# This file is licensed under the GPLv2+.
|
|
# Please visit http://git.zx2c4.com/password-store/tree/COPYING for more information.
|
|
#
|
|
# Oh my zsh plugin maintainer: Santiago Borrazás <sanbor@gmail.com>
|
|
|
|
|
|
_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
|
|
case "${cmd}" in
|
|
init)
|
|
_arguments : \
|
|
"-p[gpg-id will only be applied to this subfolder]" \
|
|
"--path[gpg-id will only be applied to this subfolder]"
|
|
_pass_complete_keys
|
|
;;
|
|
ls|list|edit)
|
|
_pass_complete_entries_with_subdirs
|
|
;;
|
|
insert)
|
|
_arguments : \
|
|
"-e[echo password to console]" \
|
|
"--echo[echo password to console]" \
|
|
"-m[multiline]" \
|
|
"--multiline[multiline]"
|
|
_pass_complete_entries_with_subdirs
|
|
;;
|
|
generate)
|
|
_arguments : \
|
|
"-n[don't include symbols in password]" \
|
|
"--no-symbols[don't include symbols in password]" \
|
|
"-c[copy password to the clipboard]" \
|
|
"--clip[copy password to the clipboard]" \
|
|
"-f[force overwrite]" \
|
|
"--force[force overwrite]" \
|
|
"-i[replace first line]" \
|
|
"--in-place[replace first line]"
|
|
_pass_complete_entries_with_subdirs
|
|
;;
|
|
cp|copy|mv|rename)
|
|
_arguments : \
|
|
"-f[force rename]" \
|
|
"--force[force rename]"
|
|
_pass_complete_entries_with_subdirs
|
|
;;
|
|
rm)
|
|
_arguments : \
|
|
"-f[force deletion]" \
|
|
"--force[force deletion]" \
|
|
"-r[recursively delete]" \
|
|
"--recursive[recursively delete]"
|
|
_pass_complete_entries_with_subdirs
|
|
;;
|
|
git)
|
|
local -a subcommands
|
|
subcommands=(
|
|
"init:Initialize git repository"
|
|
"push:Push to remote repository"
|
|
"pull:Pull from remote repository"
|
|
"config:Show git config"
|
|
"log:Show git log"
|
|
"reflog:Show git reflog"
|
|
)
|
|
_describe -t commands 'pass git' subcommands
|
|
;;
|
|
show|*)
|
|
_pass_cmd_show
|
|
;;
|
|
esac
|
|
else
|
|
local -a subcommands
|
|
subcommands=(
|
|
"init:Initialize new password storage"
|
|
"ls:List passwords"
|
|
"find:Find password files or directories based on pattern"
|
|
"grep:Search inside decrypted password files for matching pattern"
|
|
"show:Decrypt and print a password"
|
|
"insert:Insert a new password"
|
|
"generate:Generate a new password using pwgen"
|
|
"edit:Edit a password with \$EDITOR"
|
|
"mv:Rename the password"
|
|
"cp:Copy the password"
|
|
"rm:Remove the password"
|
|
"git:Call git on the password store"
|
|
"version:Output version information"
|
|
"help:Output help message"
|
|
)
|
|
_describe -t commands 'pass' subcommands
|
|
_arguments : \
|
|
"--version[Output version information]" \
|
|
"--help[Output help message]"
|
|
_pass_cmd_show
|
|
fi
|
|
}
|
|
|
|
_pass_cmd_show () {
|
|
_arguments : \
|
|
"-c[put it on the clipboard]" \
|
|
"--clip[put it on the clipboard]"
|
|
_pass_complete_entries
|
|
}
|
|
_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):-""}
|
|
}
|
|
|
|
_pass_complete_entries_with_subdirs () {
|
|
_pass_complete_entries_helper
|
|
}
|
|
|
|
_pass_complete_entries () {
|
|
_pass_complete_entries_helper -type f
|
|
}
|
|
|
|
_pass_complete_keys () {
|
|
local IFS=$'\n'
|
|
# Extract names and email addresses from gpg --list-keys
|
|
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')
|
|
}
|
|
|
|
_pass
|