diff --git a/bin/nux-runner b/bin/nux-runner index f78e139..e76755d 100755 --- a/bin/nux-runner +++ b/bin/nux-runner @@ -6,10 +6,13 @@ ### (similar in usage such as apt, git). ### -readonly NUX_RUNNER=$0; + readonly NUX_RUNNER_BIN_DIR=$(dirname $(realpath ${BASH_SOURCE[0]})) source $NUX_RUNNER_BIN_DIR/../inc/nux-base.inc.sh + +readonly NUX_RUNNER=$NUX_RUNNER_BIN_DIR/nux-runner; + nux.include nux-runner ## @@ -45,8 +48,16 @@ task.() { task.help } -readonly NUX_SCRIPT=$1; -shift; # Determines script +if [ "$NUX_RUNNER" = "$0" ] +then + readonly NUX_SCRIPT=$1; + shift; +else + readonly NUX_SCRIPT=$0; + readonly NUX_NO_INCLUDE="no include"; +fi + + # Determines script readonly NUX_SCRIPTNAME=$(basename $NUX_SCRIPT) nux-runner.run "$@" diff --git a/inc/nux-runner.inc.sh b/inc/nux-runner.inc.sh index cd8863d..a8c4cba 100644 --- a/inc/nux-runner.inc.sh +++ b/inc/nux-runner.inc.sh @@ -2,13 +2,16 @@ nux-runner.run() { TASK=$1; shift; # Determines task - if nux.check.function task.$TASK ; then + if nux.check.function task.$TASK + then nux.log debug "Running task: $TASK"; task.$TASK "$@" # Runs task else - nux.log debug "Including script: $NUX_SCRIPT" - source $NUX_SCRIPT; # Includes script - + if [ -z "$NUX_NO_INCLUDE" ] + then + nux.log debug "Including script: $NUX_SCRIPT" + source $NUX_SCRIPT; # Includes script + fi if nux.check.function task.$TASK ; then nux.log debug "Running task: $TASK"; task.$TASK "$@" # Runs task