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>
#
# 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]|)) ]]
# Checks if a file can be autoloaded by trying to load it in a subshell.
function is-autoloadable {
( unfunction $1 ; autoload -U +X $1 ) &> /dev/null
}
# Checks a name if it is a command, function, or alias.
@ -16,6 +15,12 @@ function is-callable {
(( $+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.
function coalesce {
for arg in $argv; do
@ -25,8 +30,3 @@ function coalesce {
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
}