Browse Source

Renamed check-bool to is-true.

master
Sorin Ionescu 13 years ago
parent
commit
b2fcfc684c
  1. 2
      helper.zsh
  2. 6
      plugins/git/functions/git-info
  3. 2
      plugins/screen/init.zsh
  4. 2
      plugins/ssh-agent/init.zsh
  5. 2
      plugins/tmux/init.zsh

2
helper.zsh

@ -4,7 +4,7 @@ function autoloadable() {
} }
# Checks boolean variable for "true" (case insensitive "1", "y", "yes", "t", "true", "o", and "on"). # 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]|)) ]] [[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
} }

6
plugins/git/functions/git-info

@ -60,7 +60,7 @@ function _git-action() {
# Turns off git-info for the current repository. # Turns off git-info for the current repository.
function _git-info-abort() { function _git-info-abort() {
if ! check-bool "$_git_info_executing"; then if ! is-true "$_git_info_executing"; then
return 1 return 1
fi fi
@ -146,7 +146,7 @@ function git-info() {
unset git_rprompt_info unset git_rprompt_info
# Return if not inside a Git repository work tree. # 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 return 1
fi fi
@ -162,7 +162,7 @@ function git-info() {
fi fi
# Return if git-info is disabled. # 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 return 1
fi fi

2
plugins/screen/init.zsh

@ -11,7 +11,7 @@ alias sn="screen -U -S"
alias sr="screen -a -A -U -D -R" alias sr="screen -a -A -U -D -R"
# Auto # Auto
if (( $SHLVL == 1 )) && check-bool "$AUTO_SCREEN"; then if (( $SHLVL == 1 )) && is-true "$AUTO_SCREEN"; then
(( SHLVL += 1 )) && export SHLVL (( SHLVL += 1 )) && export SHLVL
session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)" session="$(screen -list 2> /dev/null | sed '1d;$d' | awk '{print $1}' | head -1)"
if [[ -n "$session" ]]; then if [[ -n "$session" ]]; then

2
plugins/ssh-agent/init.zsh

@ -40,7 +40,7 @@ function _ssh-agent-start() {
# Test if agent-forwarding is enabled. # Test if agent-forwarding is enabled.
zstyle -b ':omz:plugin:ssh-agent' forwarding '_ssh_agent_forwarding' 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. # Add a nifty symlink for screen/tmux if agent forwarding.
[[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen [[ -L "$SSH_AUTH_SOCK" ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
elif [ -f "${_ssh_agent_env}" ]; then elif [ -f "${_ssh_agent_env}" ]; then

2
plugins/tmux/init.zsh

@ -10,7 +10,7 @@ alias ta="tmux attach-session"
alias tl="tmux list-sessions" alias tl="tmux list-sessions"
# Auto # Auto
if (( $SHLVL == 1 )) && check-bool "$AUTO_TMUX"; then if (( $SHLVL == 1 )) && is-true "$AUTO_TMUX"; then
(( SHLVL += 1 )) && export SHLVL (( SHLVL += 1 )) && export SHLVL
session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)" session="$(tmux list-sessions 2> /dev/null | cut -d':' -f1 | head -1)"
if [[ -n "$session" ]]; then if [[ -n "$session" ]]; then

Loading…
Cancel
Save