Cleanup of stdout

This commit is contained in:
Dylan 2016-02-06 02:25:21 +11:00
parent 5e5cf5da2a
commit 8da6f40ce0
1 changed files with 12 additions and 11 deletions

23
fetch
View File

@ -1822,15 +1822,19 @@ info () {
# Print the string # Print the string
if [ "$stdout" == "on" ]; then if [ "$stdout" == "on" ]; then
# Unset the vars containg escape codes as lemonbar doesn't # Unset the vars containg escape codes as lemonbar doesn't
# support them. # support them.
unset subtitle bold subtitle_color clear colon_color info_color \ unset bold subtitle_color clear colon_color info_color \
underline_color title_color at_color underline_color title_color at_color
# Remove subtitles from output. # Show/Hide subtitles
[ "$stdout_subtitles" == "off" ] && string=${string/*: } [ "$stdout_subtitles" == "off" ] && \
string=${string/*: }
# If the string isn't empty, print it.
[ ! -z "$string" ] && printf "%s" "${string}${stdout_seperator}" [ ! -z "$string" ] && printf "%s" "${string}${stdout_seperator}"
else else
printf "%b%s\n" "${padding}${string}${clear}" printf "%b%s\n" "${padding}${string}${clear}"
fi fi
@ -2187,22 +2191,19 @@ while [ "$1" ]; do
--stdout_seperator) stdout_seperator="$2" ;; --stdout_seperator) stdout_seperator="$2" ;;
--stdout_subtitles) stdout_subtitles="$2" ;; --stdout_subtitles) stdout_subtitles="$2" ;;
--stdout) --stdout)
# Disable images and color blocks
stdout="on" stdout="on"
image="off" image="off"
color_blocks="off" color_blocks="off"
# Remove info color escape code.
unset info_color
for func in "$@"; do for func in "$@"; do
case "$func" in case "$func" in
"--stdout") continue ;; "--stdout") continue ;;
"--"*) break ;; "--"*) break ;;
*) *) info "$func" ;;
# Call the function
get$func 2>/dev/null
eval output="\$${func}"
# Print the output
printf "%s" "${output}"
;;
esac esac
done done