File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,36 @@ argGetName() {
7373 exit 1
7474}
7575
76+ argList () {
77+ echo " ARGUMENT SUMMARY:"
78+ for arguments in " ${! argExpected[@]} " ; do
79+
80+ local argumentsPrefixed=()
81+
82+ # Take all the arguments and prefix them with hyphens
83+ while IFS=' |' read -ra argumentArray; do
84+ for argument in " ${argumentArray[@]} " ; do
85+
86+ # Add the hyphens
87+ if [[ ${# argument} -gt 1 ]]; then
88+ argumentsPrefixed+=(" --$argument " )
89+ else
90+ argumentsPrefixed+=(" -$argument " )
91+ fi
92+ done
93+ done <<< " $arguments"
94+
95+ regexArgName=" .+ - (.+)"
96+ [[ " ${argExpected[$arguments]} " =~ $regexArgName ]]
97+
98+ local argumentList=" ${argumentsPrefixed[@]} "
99+ local argumentDesc=" ${BASH_REMATCH[1]} "
100+ echo " $argumentList "
101+ echo " $argumentDesc "
102+ echo
103+ done
104+ }
105+
76106argUnexpected () {
77107 echo " UNEXPECTED ARGUMENT $1 "
78108}
@@ -202,4 +232,5 @@ argParse() {
202232# If we are accessing this script directly run the argument parser, useful for testing
203233if [ " $0 " == " $BASH_SOURCE " ]; then
204234 argParse
235+ argList
205236fi
You can’t perform that action at this time.
0 commit comments