mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Reworking this plugin to work around a keychain function
This commit is contained in:
parent
534b4ab12e
commit
1f659b16db
1 changed files with 14 additions and 16 deletions
|
|
@ -1,6 +1,4 @@
|
|||
local ssh_env=$HOME/.ssh/environment-$HOST
|
||||
|
||||
function start_agent()
|
||||
function keychain_start_agent()
|
||||
{
|
||||
local -a identities
|
||||
|
||||
|
|
@ -15,23 +13,23 @@ function start_agent()
|
|||
}
|
||||
|
||||
function keychain() {
|
||||
local ssh_env=$HOME/.ssh/environment-$HOST
|
||||
|
||||
case $1 in
|
||||
"start") ;;
|
||||
"start")
|
||||
if [[ -f $ssh_env ]]; then
|
||||
source $ssh_env >/dev/null
|
||||
ps -p $SSH_AGENT_PID >/dev/null || keychain_start_agent
|
||||
else
|
||||
keychain_start_agent;
|
||||
fi
|
||||
;;
|
||||
"kill")
|
||||
ssh-agent -k
|
||||
echo "Stopping agent"
|
||||
ssh-agent -k >/dev/null
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
zstyle -a :omz:plugins:keychain autostart state
|
||||
if [[ $state == "on" ]]; then
|
||||
if [[ -f $ssh_env ]]; then
|
||||
source $ssh_env >/dev/null
|
||||
ps -p $SSH_AGENT_PID >/dev/null || start_agent
|
||||
else
|
||||
start_agent;
|
||||
fi
|
||||
fi
|
||||
|
||||
unfunction start_agent
|
||||
unset ssh_env
|
||||
[[ $state == "on" ]] && keychain start
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue