diff options
author | Robby Russell <robby@planetargon.com> | 2018-12-31 11:17:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 11:17:29 -0800 |
commit | 8961fda153af5766f27c297e007f06e17c87a4fe (patch) | |
tree | 892506dc0431db5f2483d74df73a8cb47c032316 /plugins/keychain/keychain.plugin.zsh | |
parent | 0cc1266c17204b84255f924f099152c9e4f0383f (diff) | |
parent | 95a3b2768033627d9ba3e347f368dffae92906b7 (diff) | |
download | zsh-8961fda153af5766f27c297e007f06e17c87a4fe.tar.gz zsh-8961fda153af5766f27c297e007f06e17c87a4fe.tar.bz2 zsh-8961fda153af5766f27c297e007f06e17c87a4fe.zip |
Add keychain plugin (#7385)
This plugin integrates the Keychain tool[1] in to the project.
[1] [keychain](https://www.funtoo.org/Keychain)
Diffstat (limited to 'plugins/keychain/keychain.plugin.zsh')
-rw-r--r-- | plugins/keychain/keychain.plugin.zsh | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh new file mode 100644 index 000000000..af34793e7 --- /dev/null +++ b/plugins/keychain/keychain.plugin.zsh @@ -0,0 +1,32 @@ +function _start_agent() { + local agents + local -a identities + local -a options + local _keychain_env_sh + local _keychain_env_sh_gpg + + # load agents to start. + zstyle -s :omz:plugins:keychain agents agents + + # load identities to manage. + zstyle -a :omz:plugins:keychain identities identities + + # load additional options + zstyle -a :omz:plugins:keychain options options + + # start keychain... + keychain ${^options:-} --agents ${agents:-gpg} ${^identities} + + # Get the filenames to store/lookup the environment from + _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh" + _keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg" + + # Source environment settings. + [ -f "$_keychain_env_sh" ] && . "$_keychain_env_sh" + [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg" +} + +_start_agent + +# tidy up after ourselves +unfunction _start_agent |