]> arthur.barton.de Git - ax-zsh.git/commitdiff
New "ssh_autoadd" plugin
authorAlexander Barton <alex@barton.de>
Sat, 30 Sep 2017 20:24:30 +0000 (22:24 +0200)
committerAlexander Barton <alex@barton.de>
Sat, 30 Sep 2017 20:24:30 +0000 (22:24 +0200)
Automatically call "ssh-autoadd" for new shell sessions, making sure
that SSH keys are available.

plugins/ssh_autoadd/README.md [new file with mode: 0644]
plugins/ssh_autoadd/ssh_autoadd.zshrc [new file with mode: 0644]

diff --git a/plugins/ssh_autoadd/README.md b/plugins/ssh_autoadd/README.md
new file mode 100644 (file)
index 0000000..2996b7e
--- /dev/null
@@ -0,0 +1,4 @@
+## ssh_autoadd
+
+Automatically call "ssh-autoadd" for new shell sessions, making sure that SSH
+keys are available.
diff --git a/plugins/ssh_autoadd/ssh_autoadd.zshrc b/plugins/ssh_autoadd/ssh_autoadd.zshrc
new file mode 100644 (file)
index 0000000..10ac92e
--- /dev/null
@@ -0,0 +1,14 @@
+# AX-ZSH: Alex' Modular ZSH Configuration
+# ssh_autoadd.zshrc: Make sure that SSH keys are available
+
+# Make sure that "ssh(1)" is installed.
+(( $+commands[ssh] )) || return 1
+
+# This plugin is optional.
+[[ -z "$AXZSH_PLUGIN_CHECK" ]] || return 92
+
+# Make sure that an SSH agent is available (but ignore failure):
+[[ -n "$SSH_AUTH_SOCK" ]] || return 0
+
+# Call the ax-zsh "ssh-autoadd" function.
+[[ -t 1 ]] && ssh-autoadd -v