Merged
fix: validate build help option combinations #2353
fix: validate build help option combinations #2353
Merged
RobellAdd on May 20
Total: 1 files changed+6-3
@@ -200,7 +200,7 @@ check_help_combinations() {
200 local has_cov=false200 local has_cov=false
201 local has_pkg=false201 local has_pkg=false
202 202 
203- for arg in "${arg[@]}"; do203+ for arg in "${args[@]}"; do
204 case "$arg" in204 case "$arg" in
205 -t|--test) has_test=true ;;205 -t|--test) has_test=true ;;
206 --adv_test) test_part="adv_test" ;;206 --adv_test) test_part="adv_test" ;;
@@ -225,8 +225,8 @@ check_help_combinations() {
225 log "[ERROR] --pkg cannot be used with test(-t, --test, --$test_part)."225 log "[ERROR] --pkg cannot be used with test(-t, --test, --$test_part)."
226 return 1226 return 1
227 fi227 fi
228- if [[ "$has_cov" == "true" && ("$has_test" == "true" || -n "$test_part") ]]; then228+ if [[ "$has_cov" == "true" && "$has_test" != "true" && -z "$test_part" ]]; then
229- log "[ERROR] --cov must be used with test(-t, --test, --$test_part)."229+ log "[ERROR] --cov must be used with test(-t, --test) or a test part option."
230 return 1230 return 1
231 fi231 fi
232 return 0232 return 0
@@ -245,6 +245,9 @@ check_param_with_help() {
245 seen=()245 seen=()
246 for arg in "$@"; do246 for arg in "$@"; do
247 arg="${arg%%=*}"247 arg="${arg%%=*}"
248+ if [[ "$arg" =~ ^-j[0-9]+$ ]]; then
249+ arg="-j"
250+ fi
248 if [[ " ${seen[@]} " =~ " $arg " ]]; then251 if [[ " ${seen[@]} " =~ " $arg " ]]; then
249 log "[ERROR] $arg can only be input one."252 log "[ERROR] $arg can only be input one."
250 exit 1253 exit 1