1
0
Fork 0

Renamed check-bool to is-true.

pull/4/head
Sorin Ionescu 13 years ago
parent 84ce0f42b5
commit b2fcfc684c

@ -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]|)) ]]
} }

@ -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

@ -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

@ -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

@ -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