Fix '--stdout_seperator' not working when '--stdout' gets args

This commit is contained in:
Dylan 2016-02-06 10:04:50 +11:00
parent 84b8b04d83
commit 6f69aed92e
1 changed files with 36 additions and 17 deletions

43
fetch
View File

@ -1870,6 +1870,26 @@ prin () {
# }}} # }}}
# Stdout {{{
stdout () {
index=1
for func in "${args[@]}"; do
case "$func" in
"--stdout") continue ;;
"--"*) break ;;
*)
case "${args[$((index + 1))]}" in "--"*) unset stdout_seperator ;; esac
info "$func"
;;
esac
index=$((index + 1))
done
}
# }}}
# Underline {{{ # Underline {{{
getunderline () { getunderline () {
@ -2190,20 +2210,15 @@ 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)
stdout="on" case "$2" in
"--"* | "") stdout="on" ;;
*) stdout="on"; stdout_args="on" ;;
esac
unset info_color
image="off" image="off"
color_blocks="off" color_blocks="off"
unset info_color args=("$@")
for func in "$@"; do
case "$func" in
"--stdout") continue ;;
"--"*) break ;;
*) info "$func" ;;
esac
done
[ ! -z "$output" ] && exit
;; ;;
# Other # Other
@ -2269,12 +2284,16 @@ fi
# Move cursor to the top # Move cursor to the top
[ "$image" != "off" ] && printf "\033[0H" [ "$image" != "off" ] && printf "\033[0H"
if [ "$stdout_args" == "on" ]; then
stdout
else
# Get colors / bold # Get colors / bold
colors colors
bold bold
# Print the info # Print the info
printinfo printinfo
fi
if [ "$image" != "off" ]; then if [ "$image" != "off" ]; then
# Get cursor position # Get cursor position