1
0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2025-09-22 02:57:09 +08:00

feat(keychain): support >2.9 (#13189)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
Zachary Craig 2025-07-18 06:44:05 -04:00 committed by GitHub
parent 3e7ef0182f
commit df200c943a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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