Commit 670fb223 authored by Dylan's avatar Dylan

Simplified sdtout function

parent c9157fbd
......@@ -1963,25 +1963,25 @@ prin () {
# Stdout {{{
stdout () {
# Read args early for the separator
stdout_separator_flag="$(awk -F '--stdout_separator ' '{printf $2}' <<< "${args[@]}")"
stdout_separator_flag=${stdout_separator_flag/ '--'*}
[ ! -z "$stdout_separator_flag" ] && \
stdout_separator="$stdout_separator_flag"
index=0
for func in "${args[@]}"; do
case "$func" in
"--"*) break ;;
*)
"get$func" 2>/dev/null
eval output="\$$func"
case "${args[$((index + 1))]}" in "--"*) unset stdout_separator ;; esac
printf "%s" "${output}${stdout_separator}"
stdout+="${output}${stdout_separator}"
;;
esac
index=$((index + 1))
done
printf "%s" "${stdout%%${stdout_separator}}"
exit
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment