summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZachary Craig <zack@zack6849.com>2025-07-18 06:44:05 -0400
committerGitHub <noreply@github.com>2025-07-18 12:44:05 +0200
commitdf200c943a1dcfa040f334b8006e495af39205fd (patch)
tree04afe4fcb4fa42c3f2db1df3f7a8322619607191 /plugins
parent3e7ef0182f59c7990a52cf6ec2981adb56d5b368 (diff)
downloadzsh-df200c943a1dcfa040f334b8006e495af39205fd.tar.gz
zsh-df200c943a1dcfa040f334b8006e495af39205fd.tar.bz2
zsh-df200c943a1dcfa040f334b8006e495af39205fd.zip
feat(keychain): support >2.9 (#13189)
Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
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"