Skip to content

Commit 00705dd

Browse files
committed
Extracted out the getting of an arguments default value to a new method argValueDefault
1 parent 1ed94a3 commit 00705dd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

argument-parser.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,19 @@ argHasDefault() {
141141
fi
142142
}
143143

144+
argValueDefault() {
145+
if argHasDefault "$1"; then
146+
echo "${argd["$1"]}"
147+
fi
148+
}
149+
144150
argValue() {
145151
if argPassed "$1"; then
146152
echo "${argv["$1"]}"
147153
exit 0
148154
fi
149155

150-
if argHasDefault "$1"; then
151-
echo "${argd["$1"]}"
152-
fi
156+
echo "$(argValueDefault "$1")"
153157
}
154158

155159
argParseDefaults() {

0 commit comments

Comments
 (0)