2024-03-25 10:22:01 +01:00

35 lines
935 B
Bash

runScript() {
# go to source path (if neccessary)
pushd $SOURCE_PATH >/dev/null 2>&1
local runFunctions=${@// /|}
#echo "DEBUG - runFunctions: $runFunctions"
# in the execution there are in- and dependent tasks, this file ensures that everything
# will be executed in a helpful way
if [[ "$runFunctions" = *"help"* ]]; then
help
fi
# run config functions
if [[ "$runFunctions" = *"config"* ]]; then
if [[ "$runFunctions" = *"config init"* ]]; then
configInit
elif [[ "$runFunctions" = *"config print"* ]]; then
configPrint
exit
elif [[ "$runFunctions" = *"config set"* ]]; then
echo "Setting configurations is not yet supported"
fi
fi
local parseArgsFunc="parseArgs_$ACTION"
local isParseArgsDefined=$(type -t $parseArgsFunc)
if [ "function" == "$isParseArgsDefined" ]; then
"$parseArgsFunc" "${@:2}"
fi
"$ACTION" "${@:2}"
# return to initial path (if neccessary)
popd >/dev/null 2>&1
}