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

nuxfs: Added support for specifying path.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2016-11-28 16:13:21 +01:00
parent ff642e4222
commit fbf020f0d3
3 changed files with 31 additions and 10 deletions

View file

@ -31,6 +31,10 @@ function nuxfs.dsl.command {
if [[ "$NESTED_DIR" = "$localFile"* || "$localFile" = "$NESTED_DIR"* ]]; then
nux.log debug $localFile is affected by $NESTED_DIR;
if [[ "$NESTED_DIR" = "$localFile/" || "$localFile" = "$NESTED_DIR"* ]]; then
NUXFS_TARGET_FOUND=1;
fi
if nuxfs.file.exists "$localFile"; then
nux.log debug "File $NC_White$localFile$NC_No exits";
exec.if.function $CMD.exists def.exists "$localFile" "$@";
@ -102,7 +106,11 @@ function nuxfs.dsl.execute {
declare -a DIR_ARRAY
DIR_ARRAY[0]=$DIR
if test -e "$DEF"; then
NUXFS_TARGET_FOUND=0;
source "$DEF";
if [ $NUXFS_TARGET_FOUND = 0 ]; then
nuxfs.warning "$3" "Does not have definition in $DEF";
fi
else
nuxfs.error "$DEF" Definition file does not exists.
fi

View file

@ -2,18 +2,22 @@ function nuxfs.relative {
echo "$(nuxfs.dir.get)/$1"
}
function nuxfs.relative-to-pwd {
realpath -s "$1" --relative-to "$(realpath "$(pwd)")"
}
function nuxfs.error {
local filename=$1; shift;
local filename=$(nuxfs.relative-to-pwd "$1"); shift;
nux.echo.error "$filename"$NC_No: $*;
}
function nuxfs.warning {
local filename=$1; shift;
local filename=$(nuxfs.relative-to-pwd "$1"); shift;
nux.echo.warning "$filename"$NC_No: $*;
}
function nuxfs.info {
local filename=$1; shift;
local filename=$(nuxfs.relative-to-pwd "$1"); shift;
echo -e $NC_White"$filename"$NC_No: $*;
}
@ -36,7 +40,7 @@ function nuxfs.file.exists {
function nuxfs.closest {
cmd=$1;
cdir=$(pwd);
cdir=$2;
nux.log trace "Searching in: " $cdir;
until [ -e "$cdir/$1" -o "$cdir" == "/" ]; do
cdir=$(dirname "$cdir");