Renamed check-bool to is-true.
This commit is contained in:
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").
|
||||
function check-bool() {
|
||||
function is-true() {
|
||||
[[ -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.
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user