From b2fcfc684c1aa9a26418c41a7eebaa9cc4a66bf9 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Fri, 20 Jan 2012 22:03:17 -0500 Subject: [PATCH] Renamed check-bool to is-true. --- helper.zsh | 2 +- plugins/git/functions/git-info | 6 +++--- plugins/screen/init.zsh | 2 +- plugins/ssh-agent/init.zsh | 2 +- plugins/tmux/init.zsh | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/helper.zsh b/helper.zsh index cf28d07..dc25281 100644 --- a/helper.zsh +++ b/helper.zsh @@ -4,7 +4,7 @@ function autoloadable() { } # Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). -function check-bool() { +function is-true() { [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]] } diff --git a/plugins/git/functions/git-info b/plugins/git/functions/git-info index 0d2f931..c0854c4 100644 --- a/plugins/git/functions/git-info +++ b/plugins/git/functions/git-info @@ -60,7 +60,7 @@ function _git-action() { # Turns off git-info for the current repository. function _git-info-abort() { - if ! check-bool "$_git_info_executing"; then + if ! is-true "$_git_info_executing"; then return 1 fi @@ -146,7 +146,7 @@ function git-info() { unset git_rprompt_info # Return if not inside a Git repository work tree. - if ! check-bool "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then + if ! is-true "$(git rev-parse --is-inside-work-tree 2> /dev/null)"; then return 1 fi @@ -162,7 +162,7 @@ function git-info() { fi # Return if git-info is disabled. - if ! check-bool "${$(git config --bool prompt.showinfo):-true}"; then + if ! is-true "${$(git config --bool prompt.showinfo):-true}"; then return 1 fi diff --git a/plugins/screen/init.zsh b/plugins/screen/init.zsh index 9e45e2c..e46283b 100644 --- a/plugins/screen/init.zsh +++ b/plugins/screen/init.zsh @@ -11,7 +11,7 @@ alias sn="screen -U -S" alias sr="screen -a -A -U -D -R" # Auto -if (( $SHLVL == 1 )) && check-bool "$AUTO_SCREEN"; then +if (( $SHLVL == 1 )) && is-true "$AUTO_SCREEN"; then (( SHLVL += 1 )) && export SHLVL session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" if [[ -n "$session" ]]; then diff --git a/plugins/ssh-agent/init.zsh b/plugins/ssh-agent/init.zsh index b92dcd7..3f7a526 100644 --- a/plugins/ssh-agent/init.zsh +++ b/plugins/ssh-agent/init.zsh @@ -40,7 +40,7 @@ function _ssh-agent-start() { # Test if agent-forwarding is enabled. zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding' -if check-bool "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then +if is-true "${_ssh_agent_forwarding}" && [[ -n "$SSH_AUTH_SOCK" ]]; then # Add a nifty symlink for screen/tmux if agent forwarding. [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen elif [ -f "${_ssh_agent_env}" ]; then diff --git a/plugins/tmux/init.zsh b/plugins/tmux/init.zsh index 3e54acf..8e21335 100644 --- a/plugins/tmux/init.zsh +++ b/plugins/tmux/init.zsh @@ -10,7 +10,7 @@ alias ta="tmux attach-session" alias tl="tmux list-sessions" # Auto -if (( $SHLVL == 1 )) && check-bool "$AUTO_TMUX"; then +if (( $SHLVL == 1 )) && is-true "$AUTO_TMUX"; then (( SHLVL += 1 )) && export SHLVL session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" if [[ -n "$session" ]]; then