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

Added foldy

This commit is contained in:
Tony Tkáčik 2025-07-23 13:50:09 +02:00
parent bd6e1d49b2
commit 5b31a1c69e
2 changed files with 40 additions and 2 deletions

35
bin/foldy Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/env nuxr-nuxsh
nux.use nux/fs
CLOSEST=$(nux.fs.closest .foldy.nuxsh)
## suffix:: <file>
## Adds random UUID suffix to file names if file does not have UUID in name already.
@command list {
nux.fs.info "Listing foldy files in $CLOSEST"
}
@command help.additional {
echo "Tasks defined in ${NC_White}$CLOSEST${NC_No}"
echo "Custom Help"
nux.help.comment "$CLOSEST"
}
nuxr.run.additional {
if [[ -f "$CLOSEST" ]]; then
nux.log debug Loading sources fron "$CLOSEST"
nux.nuxsh.use "$CLOSEST"
fi
if nux.check.function task.$TASK; then
nux.log debug "Running task: $TASK";
nux.log debug "Working dir: $(pwd)"
task.$TASK "$@" # Runs task
else
echo "$NUX_SCRIPTNAME: Unrecognized task '$TASK' not available."
echo "Try '$NUX_SCRIPTNAME help' for more information."
return -1
fi
}

View file

@ -8,15 +8,18 @@ nux.use nux/help
@namespace nuxr. {
function :run TASK {
# FIXME: Add default task
if check:function task.$TASK {
if nux.check.function task.$TASK; then
nux.log debug "Running task: $TASK";
nux.log debug "Working dir: $(pwd)"
task.$TASK "$@" # Runs task
elif nux.check.function nuxr.run.additional; then
nux.log debug "Running additional task: $TASK";
nuxr.run.additional "$TASK" "$@"
else
echo "$NUX_SCRIPTNAME: Unrecognized task '$TASK' not available."
echo "Try '$NUX_SCRIPTNAME help' for more information."
return -1
}
fi
}
function :run.subtask SUBTASK {