[zsh] Convert zprofile to do_init_functions
This commit is contained in:
parent
20414bb31c
commit
edf8034308
2 changed files with 14 additions and 21 deletions
27
zprofile
27
zprofile
|
@ -1,26 +1,11 @@
|
||||||
#!/usr/bin/env zsh
|
#!/usr/bin/env zsh
|
||||||
# Eryn Wells <eryn@erynwells.me>
|
# Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
# Start SSH agent for password-less logins
|
zsh_init_profile_functions=( \
|
||||||
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
|
connect_ssh_agent \
|
||||||
if ! pgrep -u $USER ssh-agent 1>/dev/null; then
|
init_profile_$SYS \
|
||||||
eval $(ssh-agent -s > ~/.ssh_agent_vars)
|
list_tmux_sessions \
|
||||||
trap "kill $SSH_AGENT_PID" 0
|
)
|
||||||
else
|
|
||||||
eval $(cat ~/.ssh_agent_vars)
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
autoload -Uz list_tmux_sessions
|
do_init_functions zsh_init_profile_functions
|
||||||
autoload -Uz binary_exists
|
|
||||||
|
|
||||||
if binary_exists sw_vers && binary_exists lolcat; then
|
|
||||||
case $SYS in
|
|
||||||
darwin)
|
|
||||||
print "It's `date +'%H:%M on %A, %B %d'`.\nThis machine is a $HWMODEL.\nYou're running macOS $OSVERSION.\n" | lolcat
|
|
||||||
;;
|
|
||||||
*) ;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
list_tmux_sessions
|
|
||||||
|
|
|
@ -5,3 +5,11 @@ if ssh-add --apple-load-keychain; then
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if binary_exists sw_vers; then
|
||||||
|
cat_program=cat
|
||||||
|
if binary_exists lolcat; then
|
||||||
|
cat_program=lolcat
|
||||||
|
fi
|
||||||
|
print "It's `date +'%H:%M on %A, %B %d'`.\nThis machine is a $HWMODEL.\nYou're running macOS $OSVERSION.\n" | $cat_program
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue