Browse Source

Rename autoloadable to is-autoloadable

master
Sorin Ionescu 12 years ago
parent
commit
10f333f45c
  1. 18
      modules/helper/init.zsh

18
modules/helper/init.zsh

@ -5,10 +5,9 @@
# Sorin Ionescu <sorin.ionescu@gmail.com> # Sorin Ionescu <sorin.ionescu@gmail.com>
# #
# Checks a boolean variable for "true". # Checks if a file can be autoloaded by trying to load it in a subshell.
# Case insensitive: "1", "y", "yes", "t", "true", "o", and "on". function is-autoloadable {
function is-true { ( unfunction $1 ; autoload -U +X $1 ) &> /dev/null
[[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
} }
# Checks a name if it is a command, function, or alias. # Checks a name if it is a command, function, or alias.
@ -16,6 +15,12 @@ function is-callable {
(( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] )) (( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] ))
} }
# Checks a boolean variable for "true".
# Case insensitive: "1", "y", "yes", "t", "true", "o", and "on".
function is-true {
[[ -n "$1" && "$1" == (1|[Yy]([Ee][Ss]|)|[Tt]([Rr][Uu][Ee]|)|[Oo]([Nn]|)) ]]
}
# Prints the first non-empty string in the arguments array. # Prints the first non-empty string in the arguments array.
function coalesce { function coalesce {
for arg in $argv; do for arg in $argv; do
@ -25,8 +30,3 @@ function coalesce {
return 1 return 1
} }
# Checks if a file can be autoloaded by trying to load it in a subshell.
function autoloadable {
( unfunction $1 ; autoload -U +X $1 ) &> /dev/null
}

Loading…
Cancel
Save