1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00
nux-env/inc/nux/check.inc.sh
Tony Tkacik fc1b5bbc87 Added taskie configuration & other stuff.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
2019-01-28 06:22:49 +01:00

32 lines
583 B
Bash

## nux.check.function:: <name>
##
function nux.check.function {
nux.log trace "Checking if $1 is function."
test "$(type -t "$1")" = "function" && return 0
return 1
}
function nux.check.nuxenv.file {
path=$(realpath -Lms "$1")
[[ "$path" =~ "^$NUX_ENV_DIR" ]]
}
function nux.check.optional {
local function="$1"; shift;
if nux.check.function "$function" ; then
$function "$@"
fi
}
function nux.check.exec {
local binary=$1;
test -n "$(which "$binary")"
}
## nux.check.file.exists:: <name>
##
function nux.check.file.exists {
test -e "$1" -o -h "$1";
}