#!/usr/bin/env bash ######################## ###### FUNCTIONS ####### ######################## source functions _printHelpAndExit () { cat <<-'EOF' USAGE buildWrapper plugin [command] EXAMPLES buildWrapper podmanRunEasy --mode 0 ./myscript.sh -d -b buildWrapper podmanRunEasy --mode 1 bundle exec jekyll build --watch buildWrapper podmanRunWrapper -m ephemeral -o "--rm -it -v $PWD:$PWD -w $PWD" -i "php:latest" -c "php ./script.php" ARGUMENTS plugin Plugin to run (found in plugins/plugin_group/plugin) command Command to be passed to the plugin EOF # Exit using passed exit code [[ -z $1 ]] && exit 0 || exit "$1" } ######################## ####### EXECUTE ######## ######################## # check if bash version supports nameref checkBashVersion # source all plugins sourcePlugins # make sure that the chosen plugin exists pluginExists "$1" # Create a new named array with the arguments to be passed to the function # We will access this array by name using a nameref (-n attribute) in our functions # shellcheck disable=SC2034 declare -a _BW_ARGS=("${@:2}") # Pass the name of the array to the function "${1}" -a _BW_ARGS