m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/completion/pass.bash-completion5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/completion/pass.bash-completion b/src/completion/pass.bash-completion
index 08f3401..95d3e1e 100644
--- a/src/completion/pass.bash-completion
+++ b/src/completion/pass.bash-completion
@@ -71,9 +71,12 @@ _pass_complete_folders () {
}
_pass_complete_keys () {
+ local GPG="gpg"
+ which gpg2 &>/dev/null && GPG="gpg2"
+
local IFS=$'\n'
# Extract names and email addresses from gpg --list-keys
- local keys="$(gpg2 --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')"
+ local keys="$($GPG --list-secret-keys --with-colons | cut -d : -f 10 | sort -u | sed '/^$/d')"
COMPREPLY+=($(compgen -W "${keys}" -- ${cur}))
}