#!/bin/env bash # ARG_OPTIONAL_BOOLEAN([confirm],[c],[Wether to confirm the action or not],[on]) # ARG_OPTIONAL_SINGLE([runner],[r],[Specify the runner],[]) # ARG_TYPE_GROUP_SET([commands],[COMMAND],[runner],[node, sh],[index]) # ARG_POSITIONAL_SINGLE([context],[The Kubernetes context]) # ARG_POSITIONAL_SINGLE([script],[The script to run]) # ARG_POSITIONAL_SINGLE([pod_name],[The pod name]) # ARG_HELP([Prints this help message]) # ARG_VERSION([1.0]) # ARG_DEFAULTS_POS([]) # ARGBASH_GO() # needed because of Argbash --> m4_ignore([ ### START OF CODE GENERATED BY Argbash v2.10.0 one line above ### # Argbash is a bash code generator used to get arguments parsing right. # Argbash is FREE SOFTWARE, see https://argbash.io for more info die() { local _ret="${2:-1}" test "${_PRINT_HELP:-no}" = yes && print_help >&2 echo "$1" >&2 exit "${_ret}" } # validators commands() { local _allowed=("node" "sh") _seeking="$1" _idx=0 for element in "${_allowed[@]}"; do test "$element" = "$_seeking" && { test "$3" = "idx" && echo "$_idx" || echo "$element"; } && return 0 _idx=$((_idx + 1)) done die "Value '$_seeking' (of argument '$2') doesn't match the list of allowed values: 'node' and 'sh'" 4 } begins_with_short_option() { local first_option all_short_options='crhv' first_option="${1:0:1}" test "$all_short_options" = "${all_short_options/$first_option/}" && return 1 || return 0 } # THE DEFAULTS INITIALIZATION - POSITIONALS _positionals=() _arg_context= _arg_script= _arg_pod_name= # THE DEFAULTS INITIALIZATION - OPTIONALS _arg_confirm="on" _arg_runner="sh" print_help() { printf '%s\n' "Prints this help message" printf 'Usage: %s [-c|--(no-)confirm] [-r|--runner ] [-h|--help] [-v|--version]