1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-06 07:20:40 +01:00

fix(keychain): use pattern matching to detect version (#13423)

This commit is contained in:
Carlo Sala
2025-11-15 11:39:09 -03:00
committed by GitHub
parent 5a282b9b30
commit 9d93dfaa60

View File

@@ -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