Skip to content

Commit 79641fa

Browse files
authored
Merge pull request #9489 from keymanapp/fix/common/builder-parse-bug
fix(common): builder_parse broke on option parameters
2 parents 8500724 + 7fcf9a4 commit 79641fa

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

resources/builder.inc.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,7 +1183,21 @@ builder_parse() {
11831183
fi
11841184

11851185
if [[ $key =~ ^- ]]; then
1186+
1187+
# Expand short -o to --option in options lookup
1188+
if [[ ! -z ${_builder_options_short[$key]+x} ]]; then
1189+
key=${_builder_options_short[$key]}
1190+
fi
1191+
11861192
exp+=($key)
1193+
if [[ ! -z ${_builder_options_var[$key]+x} ]]; then
1194+
shift
1195+
if [[ $# -eq 0 ]]; then
1196+
_builder_parameter_error "$0" parameter "$key"
1197+
fi
1198+
1199+
exp+=("$1")
1200+
fi
11871201
else
11881202
# Expand comma separated values
11891203
if [[ $key =~ : ]]; then
@@ -1283,10 +1297,6 @@ _builder_parse_expanded_parameters() {
12831297
fi
12841298
n=$((n + 1))
12851299

1286-
# Expand short -o to --option in options lookup
1287-
if [[ ! -z ${_builder_options_short[$key]+x} ]]; then
1288-
key=${_builder_options_short[$key]}
1289-
fi
12901300
_builder_item_in_array "$key" "${_builder_options[@]}" && has_option=1 || has_option=0
12911301

12921302
if (( has_action )) && (( has_target )); then
@@ -1315,9 +1325,6 @@ _builder_parse_expanded_parameters() {
13151325
_builder_chosen_options+=("$key")
13161326
if [[ ! -z ${_builder_options_var[$key]+x} ]]; then
13171327
shift
1318-
if [[ $# -eq 0 ]]; then
1319-
_builder_parameter_error "$0" parameter "$key"
1320-
fi
13211328
# Set the variable associated with this option to the next parameter value
13221329
# A little bit of hoop jumping here to avoid issues with cygwin paths being
13231330
# corrupted too early in the game

0 commit comments

Comments
 (0)