From 9c36a5e62611148b13e8b2485e284fdcc49562b5 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 7 Mar 2012 12:01:05 -0500 Subject: [PATCH] Fix coding-style in GPG and SSH agent plugins --- plugins/gpg-agent/init.zsh | 14 +++++++------- plugins/ssh-agent/init.zsh | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/gpg-agent/init.zsh b/plugins/gpg-agent/init.zsh index f646271..b0e7c20 100644 --- a/plugins/gpg-agent/init.zsh +++ b/plugins/gpg-agent/init.zsh @@ -6,22 +6,22 @@ # Sorin Ionescu # -local GPG_ENV="$HOME/.gnupg/gpg-agent.env" +_gpg_env="$HOME/.gnupg/gpg-agent.env" if (( ! $+commands[gpg-agent] )); then return fi function _gpg-agent-start() { - /usr/bin/env gpg-agent --daemon --enable-ssh-support --write-env-file "${GPG_ENV}" > /dev/null - chmod 600 "${GPG_ENV}" - source "${GPG_ENV}" > /dev/null + gpg-agent --daemon --enable-ssh-support --write-env-file "${_gpg_env}" + chmod 600 "${_gpg_env}" + source "${_gpg_env}" } # Source GPG agent settings, if applicable. -if [[ -f "${GPG_ENV}" ]]; then - source "${GPG_ENV}" > /dev/null - ps -ef | grep "${SSH_AGENT_PID}" | grep gpg-agent > /dev/null || { +if [[ -f "${_gpg_env}" ]]; then + source "${_gpg_env}" + ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'gpg-agent' || { _gpg-agent-start } else diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index 4996f22..f67aa7f 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -20,7 +20,7 @@ # zstyle ':omz:plugin:ssh-agent' identities 'id_rsa' 'id_rsa2' 'id_github' # -_ssh_agent_env="$HOME/.ssh/environment-$HOST" +_ssh_agent_env="${HOME}/.ssh/environment-${HOST}" _ssh_agent_forwarding= function _ssh-agent-start() { @@ -30,7 +30,7 @@ function _ssh-agent-start() { rm -f "${_ssh_agent_env}" ssh-agent > "${_ssh_agent_env}" chmod 600 "${_ssh_agent_env}" - source "${_ssh_agent_env}" > /dev/null + source "${_ssh_agent_env}" # Load identies. zstyle -a ':omz:plugin:ssh-agent' identities 'identities' @@ -40,7 +40,7 @@ function _ssh-agent-start() { if [[ ! -n "${identities}" ]]; then ssh-add else - ssh-add "$HOME/.ssh/${^identities}" + ssh-add "${HOME}/.ssh/${^identities}" fi } @@ -51,8 +51,8 @@ if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen elif [ -f "${_ssh_agent_env}" ]; then # Source SSH settings, if applicable. - source "${_ssh_agent_env}" > /dev/null - ps -ef | grep "${SSH_AGENT_PID}" | grep ssh-agent$ > /dev/null || { + source "${_ssh_agent_env}" + ps -ef | grep "${SSH_AGENT_PID}" | grep -q 'ssh-agent$' || { _ssh-agent-start; } else