]> src.twobees.de Git - dotfiles.git/blob - stow/oh-my-zsh/.oh-my-zsh/plugins/keychain/keychain.plugin.zsh
...
[dotfiles.git] / stow / oh-my-zsh / .oh-my-zsh / plugins / keychain / keychain.plugin.zsh
1 (( $+commands[keychain] )) || return
2
3 # Define SHORT_HOST if not defined (%m = host name up to first .)
4 SHORT_HOST=${SHORT_HOST:-${(%):-%m}}
5
6 function {
7         local agents
8         local -a identities
9         local -a options
10         local _keychain_env_sh
11         local _keychain_env_sh_gpg
12
13         # load agents to start.
14         zstyle -s :omz:plugins:keychain agents agents
15
16         # load identities to manage.
17         zstyle -a :omz:plugins:keychain identities identities
18
19         # load additional options
20         zstyle -a :omz:plugins:keychain options options
21
22         # start keychain...
23         keychain ${^options:-} --agents ${agents:-gpg} ${^identities} --host $SHORT_HOST
24
25         # Get the filenames to store/lookup the environment from
26         _keychain_env_sh="$HOME/.keychain/$SHORT_HOST-sh"
27         _keychain_env_sh_gpg="$HOME/.keychain/$SHORT_HOST-sh-gpg"
28
29         # Source environment settings.
30         [ -f "$_keychain_env_sh" ]     && . "$_keychain_env_sh"
31         [ -f "$_keychain_env_sh_gpg" ] && . "$_keychain_env_sh_gpg"
32 }