File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ regexArgDesc='^.* - (.*)'
1212# Initialise some variables
1313declare -A argv;
1414argv=()
15+ declare -A argd;
16+ argd=()
1517declare -a argChunks
1618argChunks=()
1719declare -a parameters
@@ -131,9 +133,22 @@ argExists() {
131133 fi
132134}
133135
136+ argHasDefault () {
137+ if [ -z ${argd["$1"]+abc} ]; then
138+ return 1
139+ else
140+ return 0
141+ fi
142+ }
143+
134144argValue () {
135145 if argExists " $1 " ; then
136146 echo " ${argv["$1"]} "
147+ exit 0
148+ fi
149+
150+ if argHasDefault " $1 " ; then
151+ echo " ${argd["$1"]} "
137152 fi
138153}
139154
@@ -149,7 +164,7 @@ argParseDefaults() {
149164 # Get the name of this argument
150165 local argumentName=" $( argGetName " $arguments " ) "
151166
152- argv [" $argumentName " ]=" ${BASH_REMATCH[1]} "
167+ argd [" $argumentName " ]=" ${BASH_REMATCH[1]} "
153168 done
154169}
155170
You can’t perform that action at this time.
0 commit comments