Rename autoloadable to is-autoloadable

This commit is contained in:
Sorin Ionescu 2012-09-08 19:08:54 -04:00
parent 3d5e302777
commit 10f333f45c

View File

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