4
# Johan Venant <jvenant@invicem.pro>
5
# Brian Mattern <rephorm@rephorm.com>
6
# Jason A. Donenfeld <Jason@zx2c4.com>.
8
# This file is licensed under the GPLv2+. Please see COPYING for more information.
12
if (( CURRENT > 2)); then
14
# Set the context for the subcommand.
15
curcontext="${curcontext%:*:*}:pass-$cmd"
16
# Narrow the range of words we are looking at to exclude `pass'
19
# Run the completion for the subcommand
23
"-r[re-encrypt existing passwords]" \
24
"--reencrypt[re-encrypt existing passwords]"
28
_pass_complete_entries_with_subdirs
32
"-e[echo password to console]" \
33
"--echo[echo password to console]" \
35
"--multiline[multiline]"
36
_pass_complete_entries_with_subdirs
40
"-n[don't include symbols in password]" \
41
"--no-symbols[don't include symbols in password]" \
42
"-c[copy password to the clipboard]" \
43
"--clip[copy password to the clipboard]"
44
_pass_complete_entries_with_subdirs
48
"-f[force deletion]" \
49
"--force[force deletion]" \
50
"-r[recursively delete]" \
51
"--recursive[recursively delete]"
52
_pass_complete_entries_with_subdirs
57
"init:Initialize git repository"
58
"push:Push to remote repository"
59
"pull:Pull from remote repository"
60
"config:Show git config"
62
"reflog:Show git reflog"
64
_describe -t commands 'pass git' subcommands
73
"init:Initialize new password storage"
75
"show:Decrypt and print a password"
76
"insert:Insert a new password"
77
"generate:Generate a new password using pwgen"
78
"edit:Edit a password with \$EDITOR"
79
"rm:Remove the password"
80
"git:Call git on the password store"
81
"version:Output version information"
82
"help:Output help message"
84
_describe -t commands 'pass' subcommands
86
"--version[Output version information]" \
87
"--help[Output help message]"
94
"-c[put it on the clipboard]" \
95
"--clip[put it on the clipboard]"
96
_pass_complete_entries
98
_pass_complete_entries_helper () {
100
local prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
101
_values -C 'passwords' $(find "$prefix" \( -name .git -o -name .gpg-id \) -prune -o $@ -print | sed -e "s#${prefix}.##" -e 's#\.gpg##' | sort)
104
_pass_complete_entries_with_subdirs () {
105
_pass_complete_entries_helper
108
_pass_complete_entries () {
109
_pass_complete_entries_helper -type f
112
_pass_complete_keys () {
114
# Extract names and email addresses from gpg --list-keys
115
_values 'gpg keys' $(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')