File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -74,17 +74,28 @@ argGetName() {
7474}
7575
7676argList () {
77- echo " ARGUMENTS:"
78- for arguments in " ${! argExpected[@]} "
79- do
77+ echo " ARGUMENT SUMMARY:"
78+ for arguments in " ${! argExpected[@]} " ; do
79+
80+ # Take all the arguments and prefix them with hyphens
81+ while IFS=' |' read -ra argumentArray; do
82+ for argument in " ${argumentArray[@]} " ; do
83+
84+ # Add the hyphens
85+ if [[ ${# argument} -gt 1 ]]; then
86+ argumentsPrefixed+=(" --$argument " )
87+ else
88+ argumentsPrefixed+=(" -$argument " )
89+ fi
90+ done
91+ done <<< " $arguments"
8092
8193 regexArgName=" (.+) - (.+)"
8294 [[ " ${argExpected[$arguments]} " =~ $regexArgName ]]
8395
84- local argumentName =" ${BASH_REMATCH[1 ]} "
96+ local argumentList =" ${argumentsPrefixed[@ ]} "
8597 local argumentDesc=" ${BASH_REMATCH[2]} "
86- echo " $arguments ($argumentName )"
87- echo " $argumentDesc "
98+ echo " $argumentList $argumentDesc " | column -ts $' \t '
8899 done
89100}
90101
@@ -216,7 +227,7 @@ argParse() {
216227
217228# If we are accessing this script directly run the argument parser, useful for testing
218229if [ " $0 " == " $BASH_SOURCE " ]; then
219- argExpected[' t' ]=" test - this is a test"
230+ argExpected[' t|a|test ' ]=" test - this is a test"
220231 argParse
221232 argList
222233fi
You can’t perform that action at this time.
0 commit comments