lib/utils (type_exists): Include functions when searching for a command

This commit is contained in:
Alessandro Caianiello
2020-08-28 14:53:34 +01:00
committed by Koichi Murase
parent 0a13c13c2e
commit f22cba2905

View File

@ -161,7 +161,13 @@ is_confirmed() {
} }
# #
# Test whether a command exists # Test whether a command is defined. Includes:
# alias (command is shell alias)
# keyword (command is shell reserved word)
# function (command is shell function)
# builtin (command is shell builtin)
# file (command is disk file)
#
# $1 = cmd to test # $1 = cmd to test
# Usage: # Usage:
# if type_exists 'git'; then # if type_exists 'git'; then
@ -171,7 +177,7 @@ is_confirmed() {
# fi # fi
# #
type_exists() { type_exists() {
[ "$(type -P "$1")" ] [ "$(type -t "$1")" ]
} }
# #