#!/bin/bash # shellcheck disable=SC2154 # shellcheck disable=SC1091 if [ -f "../share/auxilium.sh" ]; then . ../share/auxilium.sh else . /usr/share/auxilium/auxilium.sh fi auxilium_test() { cat << EOF Example code: . /usr/share/auxilium/auxilium.sh _opt_function(){ echo "Bool function: ${1} ${2}" } _pos_function(){ _ARG_NAME=$1 shift echo "POS function: ${_ARG_NAME} ${@}" } auxilium_init $(basename "$0") "Test ARGS PARSE" auxilium_add opt -s b -t opt -c _opt_function -m 'Bool' auxilium_add string -s s -d 'asd' -m 'This is a long String\nFor test this help message' auxilium_add POS2 -t positional -m 'Positional2' -n * -c _pos_function auxilium_parse \${@} echo "OPT: $_AUXILIUM_ARG_opt" echo "STRING: $_AUXILIUM_ARG_string" echo "POS2: $_AUXILIUM_ARG_pos2" auxilium_usage Output: EOF auxilium_init "$(basename "$0")" -m "Test ARGS PARSE" auxilium_add opt -s b -t opt -c _opt_function -m 'Bool' auxilium_add string -s s -d default -m 'This is a long String\nFor test this help message' auxilium_add POS2 -t positional -m 'Positional2' -a -c _pos_function auxilium_parse "$@" echo "OPT: $AUXILIUM_ARG_opt" echo "STRING: $AUXILIUM_ARG_string" echo "POS2: $AUXILIUM_ARG_pos2" auxilium_usage } _opt_function(){ echo "Bool function: ${1} ${2}" } _pos_function(){ _ARG_NAME=$1 shift echo "POS function: ${_ARG_NAME} ${*}" } auxilium_test "$@"