[#125] Add a helper that checks callables
This commit is contained in:
parent
cca942ea0b
commit
a63b053e58
1 changed files with 5 additions and 0 deletions
|
@ -11,6 +11,11 @@ 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]|)) ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checks a name if it is a command, function, or alias.
|
||||||
|
function is-callable {
|
||||||
|
(( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] ))
|
||||||
|
}
|
||||||
|
|
||||||
# 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
|
||||||
|
|
Loading…
Reference in a new issue