Created
July 24, 2018 14:08
-
-
Save yogan/f3e49382f9d08dafc2e94f79bdcded7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -xg SSH_ENV $HOME/.ssh/environment | |
if test -f $SSH_ENV | |
source $SSH_ENV > /dev/null | |
end | |
function ssh_agent_start -d "start new ssh-agent" | |
__ssh_agent_echo "Initialising new ssh agent." | |
ssh-agent -c | sed 's/^echo/#echo/' > "$SSH_ENV" | |
chmod 600 $SSH_ENV | |
source "$SSH_ENV" > /dev/null | |
__ssh_agent_add_keys | |
__ssh_agent_echo "Have a safe ssh trip!" | |
end | |
function __ssh_agent_add_keys -d "add keys from ~/.ssh/ to ssh-agent" | |
__ssh_agent_echo "Adding all keys from ~/.ssh/…" | |
for file in (ls ~/.ssh/id* | grep -v '\.pub$') | |
ssh-add "$file" | |
end | |
__ssh_agent_echo "… keys added. Use ssh-add -D to remove them." | |
end | |
function __ssh_agent_echo | |
set -l powerline_font_lock_glyph \uE0A2 | |
echo $powerline_font_lock_glyph $argv | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment