Merged
fix: validate build help option combinations #2353
RobellAdd on May 20
fix: validate build help option combinations #2353
Merged
Total: 1 files changed+6-3
| @@ -200,7 +200,7 @@ check_help_combinations() { | |||
| 200 | local has_cov=false | 200 | local has_cov=false |
| 201 | local has_pkg=false | 201 | local has_pkg=false |
| 202 | 202 | ||
| 203 | - for arg in "${arg[@]}"; do | 203 | + for arg in "${args[@]}"; do |
| 204 | case "$arg" in | 204 | 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 1 | 226 | return 1 |
| 227 | fi | 227 | fi |
| 228 | - if [[ "$has_cov" == "true" && ("$has_test" == "true" || -n "$test_part") ]]; then | 228 | + 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 1 | 230 | return 1 |
| 231 | fi | 231 | fi |
| 232 | return 0 | 232 | return 0 |
| @@ -245,6 +245,9 @@ check_param_with_help() { | |||
| 245 | seen=() | 245 | seen=() |
| 246 | for arg in "$@"; do | 246 | 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 " ]]; then | 251 | if [[ " ${seen[@]} " =~ " $arg " ]]; then |
| 249 | log "[ERROR] $arg can only be input one." | 252 | log "[ERROR] $arg can only be input one." |
| 250 | exit 1 | 253 | exit 1 |