]> arthur.barton.de Git - ax-zsh.git/commitdiff
Add "keychain" plugin
authorAlexander Barton <alex@barton.de>
Wed, 8 Jul 2015 23:02:31 +0000 (01:02 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 8 Jul 2015 23:02:31 +0000 (01:02 +0200)
plugins/keychain/keychain.zshrc [new file with mode: 0644]

diff --git a/plugins/keychain/keychain.zshrc b/plugins/keychain/keychain.zshrc
new file mode 100644 (file)
index 0000000..9f8ba5f
--- /dev/null
@@ -0,0 +1,17 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# keychain.zshrc: Setup keychain(1)
+
+# Make sure that "keychain(1)" is installed
+(( $+commands[keychain] )) || return
+
+agents=""
+if (( $+commands[ssh-agent] )); then
+       [[ -z "$agents" ]] && agents="ssh" || agents="$agents,ssh"
+fi
+if (( $+commands[gpg-agent] )); then
+       [[ -z "$agents" ]] && agents="gpg" || agents="$agents,gpg"
+fi
+
+eval `keychain --agents "$agents" --eval --quick --quiet`
+
+unset agents