From df50b8b13efacbd1b9f8ce31376d188f14e17785 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Sun, 16 Jun 2024 15:16:55 +0800 Subject: [PATCH] Fix: try fix parse dinamic args --- script/build.config.sh | 5 +++-- script/build.sh | 20 ++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/script/build.config.sh b/script/build.config.sh index 98ff9f3..2a0ceb4 100644 --- a/script/build.config.sh +++ b/script/build.config.sh @@ -13,10 +13,11 @@ function parseDepArgs() { web_version="${i#*=}" shift ;; + *) + return 1 + ;; esac done - - echo "$@" } function printDepHelp() { diff --git a/script/build.sh b/script/build.sh index ea98f21..b3ae944 100755 --- a/script/build.sh +++ b/script/build.sh @@ -764,13 +764,6 @@ function loadBuildConfig() { fi } -function checkArgs() { - if [[ $# -gt 0 ]]; then - echo -e "${COLOR_RED}Invalid option: $*${COLOR_RESET}" - exit 1 - fi -} - loadBuildConfig initHostPlatforms @@ -837,14 +830,17 @@ for i in "$@"; do host_cxx="${i#*=}" shift ;; + *) + if declare -f parseDepArgs >/dev/null && parseDepArgs "$i"; then + shift + continue + fi + echo -e "${COLOR_RED}Invalid option: $i${COLOR_RESET}" + exit 1 + ;; esac done -if declare -f parseDepArgs >/dev/null; then - set -- $(parseDepArgs "$@") -fi - -checkArgs "$@" fixArgs initPlatforms autoBuild "${platforms}"