summaryrefslogtreecommitdiff
path: root/plugins/keychain
diff options
context:
space:
mode:
authorCarlo Sala <carlosalag@protonmail.com>2025-11-15 11:39:09 -0300
committerGitHub <noreply@github.com>2025-11-15 11:39:09 -0300
commit9d93dfaa60ccc7980ad69b75b1accae0232e4e8f (patch)
tree825b7cb4238244394705ea6f02572115af9ffc23 /plugins/keychain
parent5a282b9b3050e4851c15cfdb9d79af6a708988b7 (diff)
downloadzsh-9d93dfaa60ccc7980ad69b75b1accae0232e4e8f.tar.gz
zsh-9d93dfaa60ccc7980ad69b75b1accae0232e4e8f.tar.bz2
zsh-9d93dfaa60ccc7980ad69b75b1accae0232e4e8f.zip
fix(keychain): use pattern matching to detect version (#13423)
Diffstat (limited to 'plugins/keychain')
-rw-r--r--plugins/keychain/keychain.plugin.zsh5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh
index ce5351bce..23cf1af9a 100644
--- a/plugins/keychain/keychain.plugin.zsh
+++ b/plugins/keychain/keychain.plugin.zsh
@@ -20,10 +20,11 @@ function {
zstyle -a :omz:plugins:keychain options options
# 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)
+ local version_string=$(keychain --version 2>&1)
# 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
+ if [[ "$version_string" =~ 'keychain ([0-9]+\.[0-9]+)' ]] && \
+ is-at-least 2.9 "$match[1]"; then
keychain ${^options:-} ${^identities} --host $SHORT_HOST
else
keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST