1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-11 13:24:28 +01:00

nuxfs: Added cathegorize keyword.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2017-06-14 12:38:41 +02:00
parent c412900a21
commit 429a0d3258
6 changed files with 126 additions and 2 deletions

View file

@ -47,6 +47,7 @@ readonly NC_LightPurple='\033[1;35m'
readonly NC_LightCyan='\033[1;36m'
readonly NC_White=$nc_white
readonly NC_error=$NC_Red
## #Public functions:
##
## ##Logging
@ -103,11 +104,11 @@ function nux.log.level {
}
function nux.echo.error {
echo -e "${NC_error}$* ${NC_No}";
echo "${NC_error}$* ${NC_No}";
}
function nux.echo.warning {
echo -e "${NC_warning}$* ${NC_No}";
echo -e "${NC_warning}"$@" ${NC_No}";
}
## nux.use <library>
@ -117,6 +118,23 @@ function nux.use {
source "$NUX_INC_DIR/$incfile"
}
function nux.fatal {
echo "$@";
exit -1;
}
## nux.require <binary> [<common-package>]
function nux.require {
local binary=$1;
local package=${2:-$1}
if nux.check.exec "$binary" ; then
:
else
nux.fatal $1 is not present. Please check if $package is installed.
fi
}
function nux.include {
local incfile="$1.inc.sh"
source "$NUX_INC_DIR/$incfile"
@ -129,6 +147,11 @@ function nux.check.function {
return 1
}
function nux.check.exec {
local binary=$1;
test -n "$(which "$binary")"
}
## nux.check.file.exists <name>
##
function nux.check.file.exists {
@ -172,3 +195,7 @@ function nux.help.shelldoc {
-e "s/\*([^*]*)\*/${NC_White}\1${NC_No}/gI" \
}
NUX_ENV_MACHINE=/usr/
NUX_ENV_MACHINE_LOCAL=/usr/local/
NUX_ENV_USER_LOCAL=$HOME/.local