From: Matthias Kruk Date: Sun, 27 Feb 2022 08:59:27 +0000 (+0900) Subject: include/opt: Make opt_get_argv() print arguments line-by-line X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=672dab641a82378aa0be7b495a10720fdf537158;p=toolbox include/opt: Make opt_get_argv() print arguments line-by-line Because `opt_get_argv()` prints the entire command line in one line, callers cannot reliably parse individual arguments from the output. This commit modifies `opt_get_argv()` to print the arguments line- by-line. --- diff --git a/include/opt.sh b/include/opt.sh index 18c4c59..7c96c7b 100644 --- a/include/opt.sh +++ b/include/opt.sh @@ -239,6 +239,9 @@ opt_get() { } opt_get_argv() { - echo "${__opt_argv[@]}" + if ! array_to_lines "${__opt_argv[@]}"; then + return 1 + fi + return 0 }