summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/keychain/keychain.plugin.zsh11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh
index f122f7982..8caf671f5 100644
--- a/plugins/keychain/keychain.plugin.zsh
+++ b/plugins/keychain/keychain.plugin.zsh
@@ -19,8 +19,15 @@ function {
# load additional options
zstyle -a :omz:plugins:keychain options options
- # start keychain...
- keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
+ # Check keychain version to decide whether to use --agents
+ local version_string=$(keychain --version 2>&1 | head -n 2 | tail -n 1 | cut -d ' ' -f 4)
+ # start keychain, only use --agents for versions below 2.9.0
+ autoload -Uz is-at-least
+ if is-at-least 2.9 "$version_string"; then
+ keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
+ else
+ keychain ${^options:-} ${^identities} --host $SHORT_HOST
+ fi
# Get the filenames to store/lookup the environment from
_keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"