Merge pull request #9489 from keymanapp/fix/common/builder-parse-bug

fix(common): builder_parse broke on option parameters
This commit is contained in:
Marc Durdin 2023-08-31 11:08:22 +10:00 committed by GitHub
commit 79641fab79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1183,7 +1183,21 @@ builder_parse() {
fi
if [[ $key =~ ^- ]]; then
# Expand short -o to --option in options lookup
if [[ ! -z ${_builder_options_short[$key]+x} ]]; then
key=${_builder_options_short[$key]}
fi
exp+=($key)
if [[ ! -z ${_builder_options_var[$key]+x} ]]; then
shift
if [[ $# -eq 0 ]]; then
_builder_parameter_error "$0" parameter "$key"
fi
exp+=("$1")
fi
else
# Expand comma separated values
if [[ $key =~ : ]]; then
@ -1283,10 +1297,6 @@ _builder_parse_expanded_parameters() {
fi
n=$((n + 1))
# Expand short -o to --option in options lookup
if [[ ! -z ${_builder_options_short[$key]+x} ]]; then
key=${_builder_options_short[$key]}
fi
_builder_item_in_array "$key" "${_builder_options[@]}" && has_option=1 || has_option=0
if (( has_action )) && (( has_target )); then
@ -1315,9 +1325,6 @@ _builder_parse_expanded_parameters() {
_builder_chosen_options+=("$key")
if [[ ! -z ${_builder_options_var[$key]+x} ]]; then
shift
if [[ $# -eq 0 ]]; then
_builder_parameter_error "$0" parameter "$key"
fi
# Set the variable associated with this option to the next parameter value
# A little bit of hoop jumping here to avoid issues with cygwin paths being
# corrupted too early in the game