diff options
| author | Zachary Craig <zack@zack6849.com> | 2025-07-18 06:44:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-18 12:44:05 +0200 |
| commit | df200c943a1dcfa040f334b8006e495af39205fd (patch) | |
| tree | 04afe4fcb4fa42c3f2db1df3f7a8322619607191 /plugins/keychain | |
| parent | 3e7ef0182f59c7990a52cf6ec2981adb56d5b368 (diff) | |
| download | zsh-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/keychain')
| -rw-r--r-- | plugins/keychain/keychain.plugin.zsh | 11 |
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" |
