mirror of
https://github.com/tonydamage/nux-env.git
synced 2025-12-11 13:24:28 +01:00
nux-runner: Added support ti be included as source.
Signed-off-by: Tony Tkacik <atkacik@brocade.com>
This commit is contained in:
parent
8aff47bd72
commit
1737416a72
2 changed files with 21 additions and 7 deletions
|
|
@ -6,10 +6,13 @@
|
||||||
### (similar in usage such as apt, git).
|
### (similar in usage such as apt, git).
|
||||||
###
|
###
|
||||||
|
|
||||||
readonly NUX_RUNNER=$0;
|
|
||||||
readonly NUX_RUNNER_BIN_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
|
readonly NUX_RUNNER_BIN_DIR=$(dirname $(realpath ${BASH_SOURCE[0]}))
|
||||||
source $NUX_RUNNER_BIN_DIR/../inc/nux-base.inc.sh
|
source $NUX_RUNNER_BIN_DIR/../inc/nux-base.inc.sh
|
||||||
|
|
||||||
|
|
||||||
|
readonly NUX_RUNNER=$NUX_RUNNER_BIN_DIR/nux-runner;
|
||||||
|
|
||||||
nux.include nux-runner
|
nux.include nux-runner
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
@ -45,8 +48,16 @@ task.() {
|
||||||
task.help
|
task.help
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly NUX_SCRIPT=$1;
|
if [ "$NUX_RUNNER" = "$0" ]
|
||||||
shift; # Determines script
|
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)
|
readonly NUX_SCRIPTNAME=$(basename $NUX_SCRIPT)
|
||||||
|
|
||||||
nux-runner.run "$@"
|
nux-runner.run "$@"
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,16 @@
|
||||||
|
|
||||||
nux-runner.run() {
|
nux-runner.run() {
|
||||||
TASK=$1; shift; # Determines task
|
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";
|
nux.log debug "Running task: $TASK";
|
||||||
task.$TASK "$@" # Runs task
|
task.$TASK "$@" # Runs task
|
||||||
else
|
else
|
||||||
|
if [ -z "$NUX_NO_INCLUDE" ]
|
||||||
|
then
|
||||||
nux.log debug "Including script: $NUX_SCRIPT"
|
nux.log debug "Including script: $NUX_SCRIPT"
|
||||||
source $NUX_SCRIPT; # Includes script
|
source $NUX_SCRIPT; # Includes script
|
||||||
|
fi
|
||||||
if nux.check.function task.$TASK ; then
|
if nux.check.function task.$TASK ; then
|
||||||
nux.log debug "Running task: $TASK";
|
nux.log debug "Running task: $TASK";
|
||||||
task.$TASK "$@" # Runs task
|
task.$TASK "$@" # Runs task
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue