1
1
Fork 0
mirror of https://github.com/tonydamage/nux-env.git synced 2025-12-12 13:34:29 +01:00
nux-env/bin/foldy

46 lines
No EOL
1.1 KiB
Text
Executable file

#!/usr/bin/env nuxr-nuxsh
nux.use nux/fs
CLOSEST=$(nux.fs.closest .foldy.nuxsh)
## list:: List Available foldy integrated directories
@command list {
#nux.fs.info "Listing foldy files in $CLOSEST"
find -iname ".foldy.nuxsh" | while read line; do
echo "${line%.foldy.nuxsh}"
done
}
## exec:: <path> <command> [<args>]
## Run foldy command in directory.
@command run path command {
(cd $path; foldy $command "$@" )
}
@command help.additional {
echo "Tasks defined in ${NC_White}$CLOSEST${NC_No}"
echo "Custom Help"
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
}
}