Simplified sdtout function
This commit is contained in:
parent
c9157fbd67
commit
670fb2238e
1 changed files with 4 additions and 4 deletions
8
neofetch
8
neofetch
|
@ -1963,25 +1963,25 @@ prin () {
|
||||||
# Stdout {{{
|
# Stdout {{{
|
||||||
|
|
||||||
stdout () {
|
stdout () {
|
||||||
|
# Read args early for the separator
|
||||||
stdout_separator_flag="$(awk -F '--stdout_separator ' '{printf $2}' <<< "${args[@]}")"
|
stdout_separator_flag="$(awk -F '--stdout_separator ' '{printf $2}' <<< "${args[@]}")"
|
||||||
stdout_separator_flag=${stdout_separator_flag/ '--'*}
|
stdout_separator_flag=${stdout_separator_flag/ '--'*}
|
||||||
|
|
||||||
[ ! -z "$stdout_separator_flag" ] && \
|
[ ! -z "$stdout_separator_flag" ] && \
|
||||||
stdout_separator="$stdout_separator_flag"
|
stdout_separator="$stdout_separator_flag"
|
||||||
|
|
||||||
index=0
|
|
||||||
for func in "${args[@]}"; do
|
for func in "${args[@]}"; do
|
||||||
case "$func" in
|
case "$func" in
|
||||||
"--"*) break ;;
|
"--"*) break ;;
|
||||||
*)
|
*)
|
||||||
"get$func" 2>/dev/null
|
"get$func" 2>/dev/null
|
||||||
eval output="\$$func"
|
eval output="\$$func"
|
||||||
case "${args[$((index + 1))]}" in "--"*) unset stdout_separator ;; esac
|
stdout+="${output}${stdout_separator}"
|
||||||
printf "%s" "${output}${stdout_separator}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
index=$((index + 1))
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
printf "%s" "${stdout%%${stdout_separator}}"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue