Skip to content

Commit 66a3249

Browse files
committed
[update] : Use arrays to parse arguments
1 parent 2102f26 commit 66a3249

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

build.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,14 +1048,14 @@ make_iso() {
10481048

10491049

10501050
# Parse options
1051-
ARGUMENT=("${DEFAULT_ARGUMENT[@]}" "${@}")
1052-
OPTS=("a:" "b" "c:" "d" "e" "g:" "h" "j" "k:" "l:" "o:" "p:" "r" "t:" "u:" "w:" "x")
1053-
OPTL=("arch:" "boot-splash" "comp-type:" "debug" "cleaning" "cleanup" "gpgkey:" "help" "lang:" "japanese" "kernel:" "out:" "password:" "comp-opts:" "user:" "work:" "bash-debug" "nocolor" "noconfirm" "nodepend" "gitversion" "msgdebug" "noloopmod" "tarball" "noiso" "noaur" "nochkver" "channellist" "config:" "noefi" "nodebug" "nosigcheck" "normwork" "log" "logpath:" "nolog" "nopkgbuild" "pacman-debug" "confirm" "tar-type:" "tar-opts:" "add-module:" "nogitversion")
1054-
OPT="$(getopt -o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}")" || exit 1
1055-
1056-
eval set -- "${OPT}"
1057-
msg_debug "Argument: ${OPT}"
1058-
unset OPT OPTS OPTL DEFAULT_ARGUMENT
1051+
ARGUMENT=("${DEFAULT_ARGUMENT[@]}" "${@}") OPTS=("a:" "b" "c:" "d" "e" "g:" "h" "j" "k:" "l:" "o:" "p:" "r" "t:" "u:" "w:" "x") OPTL=("arch:" "boot-splash" "comp-type:" "debug" "cleaning" "cleanup" "gpgkey:" "help" "lang:" "japanese" "kernel:" "out:" "password:" "comp-opts:" "user:" "work:" "bash-debug" "nocolor" "noconfirm" "nodepend" "gitversion" "msgdebug" "noloopmod" "tarball" "noiso" "noaur" "nochkver" "channellist" "config:" "noefi" "nodebug" "nosigcheck" "normwork" "log" "logpath:" "nolog" "nopkgbuild" "pacman-debug" "confirm" "tar-type:" "tar-opts:" "add-module:" "nogitversion")
1052+
GETOPT=(-o "$(printf "%s," "${OPTS[@]}")" -l "$(printf "%s," "${OPTL[@]}")" -- "${ARGUMENT[@]}")
1053+
getopt -Q "${GETOPT[@]}" || exit 1 # 引数エラー判定
1054+
readarray -t OPT < <(getopt "${GETOPT[@]}") # 配列に代入
1055+
1056+
eval set -- "${OPT[@]}"
1057+
msg_debug "Argument: ${OPT[*]}"
1058+
unset OPT OPTS OPTL DEFAULT_ARGUMENT GETOPT
10591059

10601060
while true; do
10611061
case "${1}" in

0 commit comments

Comments
 (0)