mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
57 lines
No EOL
1.5 KiB
Text
Executable file
57 lines
No EOL
1.5 KiB
Text
Executable file
#!/usr/bin/env nuxr-nuxsh
|
|
nux.use nux/fs
|
|
|
|
FOLDY_FILE=.foldy.nuxsh
|
|
CLOSEST=$(nux.fs.closest $FOLDY_FILE)
|
|
FOLDY_DIR=$(dirname "$CLOSEST")
|
|
|
|
## list:: List Available foldy integrated directories
|
|
@command list {
|
|
#nux.fs.info "Listing foldy files in $CLOSEST"
|
|
find -name $FOLDY_FILE | while read line; do
|
|
echo "${line%.foldy.nuxsh}"
|
|
done
|
|
}
|
|
|
|
## all:: <command> [<args>]
|
|
## Run foldy command in all descendant foldy managed directories.
|
|
@command all command {
|
|
find -name $FOLDY_FILE | while read line; do
|
|
dir="${line%.foldy.nuxsh}"
|
|
nux.fs.info $dir Running foldy $command
|
|
task.run "$dir" "$command" "$@"
|
|
done
|
|
}
|
|
|
|
## exec:: <path> <command> [<args>]
|
|
## Run foldy command in directory.
|
|
@command run path command {
|
|
(cd $path; foldy $command "$@" )
|
|
}
|
|
|
|
@command help.additional {
|
|
echo
|
|
echo "Tasks defined in ${NC_White}${CLOSEST%$FOLDY_FILE}${NC_No}:"
|
|
nux.help.comment "$CLOSEST"
|
|
|
|
}
|
|
|
|
@namespace nuxr.run. {
|
|
function :additional TASK {
|
|
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
|
|
}
|
|
} |