mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
nuxfs: Updated nuxfs to behave better in REPL mode.
Signed-off-by: Tony Tkacik <tonydamage@gmail.com>
This commit is contained in:
parent
cfad8b1576
commit
1f07be6e0d
2 changed files with 31 additions and 6 deletions
22
bin/nuxfs
22
bin/nuxfs
|
|
@ -30,10 +30,10 @@ nux.use nux.dsl
|
|||
nux.use nuxfs
|
||||
|
||||
|
||||
local WORKDIR=$(pwd)
|
||||
local TEMPLATE_DIR=$NUX_ENV_DIR/templates
|
||||
local SUFFIX=".nuxfs"
|
||||
local TEMPLATE_FILTER="*$SUFFIX"
|
||||
WORKDIR=$(pwd)
|
||||
TEMPLATE_DIR=$NUX_ENV_DIR/templates
|
||||
SUFFIX=".nuxfs"
|
||||
TEMPLATE_FILTER="*$SUFFIX"
|
||||
|
||||
|
||||
|
||||
|
|
@ -95,6 +95,9 @@ task.help.dsl() {
|
|||
nux.help.comment "$NUX_INC_DIR/dsl/nuxfs.dsl"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
nuxfs.dsl.process() {
|
||||
WORKDIR=$(pwd);
|
||||
TARGET=$1;
|
||||
|
|
@ -111,7 +114,7 @@ nuxfs.dsl.process() {
|
|||
#
|
||||
if [ "$NUXFS_DEF" = "" ]; then
|
||||
nuxfs.error $(pwd) "No nuxfs configuration found."
|
||||
exit 1;
|
||||
return 1;
|
||||
fi
|
||||
NUXFS_DEF_DIR=$(dirname $NUXFS_DEF);
|
||||
TARGET_RELATIVE=$(realpath -ms "$TARGET" --relative-to "$NUXFS_DEF_DIR")
|
||||
|
|
@ -136,7 +139,7 @@ nuxfs.dsl.process() {
|
|||
# # nuxfs.warning "$3" "Does not have definition in $DEF";
|
||||
# fi
|
||||
else
|
||||
nuxfs.error "$NUXFS_DEF" Definition file does not exists.
|
||||
nux.dsl.error "$NUXFS_DEF" Definition file does not exists.
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
@ -254,6 +257,13 @@ function task.capture {
|
|||
|
||||
}
|
||||
|
||||
|
||||
nuxr.repl.expose cd pwd ls find
|
||||
|
||||
nuxr.repl.prompt() {
|
||||
echo "${nc_green}$NUX_APPNAME${nc_end}:${nc_blue}$(pwd)${nc_end}> "
|
||||
}
|
||||
|
||||
function nuxfs.template.list {
|
||||
nux.log trace "Templates folders are: $(nux.cfg.get.path templates)"
|
||||
for _dir in $(nux.cfg.get.path templates) ; do
|
||||
|
|
|
|||
|
|
@ -45,6 +45,21 @@ dir.entered() {
|
|||
fi
|
||||
}
|
||||
|
||||
.block opt-dir name
|
||||
|
||||
use-template() {
|
||||
local template=$1;
|
||||
local possible=$(nux.cfg.get.path "templates/$template.nuxfs");
|
||||
if [ -z "$possible" ] ; then
|
||||
rel_path=$template .error Template not found.
|
||||
return
|
||||
fi
|
||||
to_include=$(echo "$possible" | head -n1)
|
||||
nux.log trace "Possible templates: '$possible'"
|
||||
nux.log trace "Template $to_include will be used"
|
||||
source "$to_include"
|
||||
}
|
||||
|
||||
## link <name> <target>
|
||||
## Defines a symbolik link with specified *name*, which points to
|
||||
## specified target
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue