diff options
| author | Tuowen Zhao <ztuowen@gmail.com> | 2026-01-04 22:47:54 -0800 |
|---|---|---|
| committer | Tuowen Zhao <ztuowen@gmail.com> | 2026-01-04 22:47:54 -0800 |
| commit | 2aa4cb7a52b28722816ecfd55f3b06293332c55c (patch) | |
| tree | f02a9f3d59d109c70caf932a24e43368994e0e8c /plugins/keychain | |
| parent | 7e951c254e779ff0620537cf43ca69dd878387b4 (diff) | |
| parent | d23d3ea69fdb839088e6e5589557cce77b34aaf8 (diff) | |
| download | zsh-2aa4cb7a52b28722816ecfd55f3b06293332c55c.tar.gz zsh-2aa4cb7a52b28722816ecfd55f3b06293332c55c.tar.bz2 zsh-2aa4cb7a52b28722816ecfd55f3b06293332c55c.zip | |
Diffstat (limited to 'plugins/keychain')
| -rw-r--r-- | plugins/keychain/keychain.plugin.zsh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh index f122f7982..23cf1af9a 100644 --- a/plugins/keychain/keychain.plugin.zsh +++ b/plugins/keychain/keychain.plugin.zsh @@ -19,8 +19,16 @@ 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) + # start keychain, only use --agents for versions below 2.9.0 + autoload -Uz is-at-least + 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 + fi # Get the filenames to store/lookup the environment from _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh" |
