Remove 'print all functions' behaviour from '--stdout'

This commit is contained in:
Dylan 2016-02-20 00:19:22 +11:00
parent 75abd75765
commit 0143724f6d
2 changed files with 4 additions and 71 deletions

View File

@ -347,20 +347,4 @@ config="on"
config_file="$HOME/.config/fetch/config" config_file="$HOME/.config/fetch/config"
# }}}
# Other Options {{{
# Separator to use in stdout mode.
# --stdout_separator string
stdout_separator=" "
# Hide/Show the title in stdout mode.
# --stdout_title on/off
stdout_title="off"
# Hide/Show each info's subtitle in stdout mode.
# --stdout_subtitles on/off
stdout_subtitles="on"
# }}} # }}}

59
fetch
View File

@ -365,22 +365,6 @@ config="on"
config_file="$HOME/.config/fetch/config" config_file="$HOME/.config/fetch/config"
# }}}
# Other Options {{{
# Separator to use in stdout mode.
# --stdout_separator string
stdout_separator=" "
# Hide/Show the title in stdout mode.
# --stdout_title on/off
stdout_title="off"
# Hide/Show each info's subtitle in stdout mode.
# --stdout_subtitles on/off
stdout_subtitles="on"
# }}} # }}}
@ -2049,11 +2033,6 @@ info () {
string="${bold}${title_color}${output}" string="${bold}${title_color}${output}"
string="${string/@/${at_color}@${title_color}}" string="${string/@/${at_color}@${title_color}}"
length=${#output} length=${#output}
# Hide the title in stdout mode
[ "$stdout" == "on" ] && \
[ "$stdout_title" == "off" ] &&\
string=""
;; ;;
underline) underline)
@ -2071,22 +2050,7 @@ info () {
[ -z "$2" ] && string=${string/*: } [ -z "$2" ] && string=${string/*: }
# Print the string # Print the string
if [ "$stdout" == "on" ]; then printf "%b%s\n" "${padding}${string}${clear}"
# Unset the vars containg escape codes as lemonbar doesn't
# support them.
unset -v bold subtitle_color clear colon_color info_color \
underline_color title_color at_color
# Show/Hide subtitles
[ "$stdout_subtitles" == "off" ] && string=${string/*: }
# If the string isn't empty, print it.
[ ! -z "$string" ] && printf "%s" "${string}${stdout_separator}"
else
printf "%b%s\n" "${padding}${string}${clear}"
fi
} }
# }}} # }}}
@ -2111,11 +2075,7 @@ prin () {
esac esac
# Print the info # Print the info
if [ "$stdout" == "on" ]; then printf "%b%s\n" "${padding}${string}${clear}"
printf "%s" "${string}${stdout_separator}"
else
printf "%b%s\n" "${padding}${string}${clear}"
fi
} }
# }}} # }}}
@ -2129,7 +2089,7 @@ stdout () {
*) *)
"get$func" 2>/dev/null "get$func" 2>/dev/null
eval output="\$$func" eval output="\$$func"
printf "$output " printf "$output "
;; ;;
esac esac
done done
@ -2359,9 +2319,6 @@ usage () { cat << EOF
--stdout info info Launch fetch in stdout mode which prints the info --stdout info info Launch fetch in stdout mode which prints the info
in a plain-text format that you can use with in a plain-text format that you can use with
lemonbar etc. lemonbar etc.
--stdout_title on/off Hide/Show the title in stdout mode.
--stdout_separator string String to use as a separator in stdout mode.
--stdout_subtitles on/off Hide/Show the subtitles in stdout mode.
Screenshot: Screenshot:
@ -2484,20 +2441,12 @@ while [ "$1" ]; do
--scrot_cmd) scrot_cmd="$2" ;; --scrot_cmd) scrot_cmd="$2" ;;
# Stdout # Stdout
--stdout_title) stdout_title="$2" ;;
--stdout_separator) stdout_separator="$2" ;;
--stdout_subtitles) stdout_subtitles="$2" ;;
--stdout) --stdout)
stdout="on"
unset info_color colors unset info_color colors
case "$2" in case "$2" in
"--"* | "") ;; "--"* | "") echo "--stdout requires at least one argument"; exit ;;
*) shift; args=("$@"); stdout ;; *) shift; args=("$@"); stdout ;;
esac esac
underline="off"
image="off"
color_blocks="off"
;; ;;
# Other # Other