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

nuxfs: Added macro support.

Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
Tony Tkáčik 2017-06-11 00:17:56 +02:00
parent 7479fb53f8
commit 6ec235ce19
4 changed files with 45 additions and 17 deletions

View file

@ -21,6 +21,7 @@ sdir() {
.allways.preprocess() {
abs_path=$(realpath -Lms "$NUXFS_DEF_DIR/$path");
rel_path=$(realpath -Lms "$abs_path" --relative-base="$WORKDIR");
def_path=$(realpath -Lms "$path" --relative-to="$NUXFS_DEF_DIR")
}
.check() {
@ -28,6 +29,17 @@ sdir() {
nux.check.file.exists "$abs_path"
}
.check.failed() {
if [ -z "$NUXFS_IGNORE_MISSING" ]; then
nux.dsl.error "$rel_path" does not exists.
fi
}
dir.entered() {
if nux.check.file.exists "$abs_path/.nuxfs"; then
source "$abs_path/.nuxfs"
fi
}
should-not-exists.check() {
nux.log trace "Checking existence of $NC_White$abs_path$NC_No"
if nux.check.file.exists "$abs_path"; then
@ -41,12 +53,3 @@ should-not-exists.check.failed() {
nux.dsl.error $f Should not exists, but is present.
done
}
.check.failed() {
nux.dsl.error "$rel_path" does not exists.
}
dir.entered() {
if nux.check.file.exists "$abs_path/.nuxfs"; then
source "$abs_path/.nuxfs"
fi
}