From 672dab641a82378aa0be7b495a10720fdf537158 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sun, 27 Feb 2022 17:59:27 +0900 Subject: [PATCH] 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. --- include/opt.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 } -- 2.47.3