From 75abd757657bae5b1743756f1fc3eb73b954da37 Mon Sep 17 00:00:00 2001 From: Dylan Date: Sat, 20 Feb 2016 00:05:48 +1100 Subject: [PATCH] Simplified --stdout arg --- fetch | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/fetch b/fetch index 708f2bbc..4379a14c 100755 --- a/fetch +++ b/fetch @@ -2123,21 +2123,17 @@ prin () { # Stdout {{{ stdout () { - printinfo () { - index=1 - for func in "${args[@]}"; do - - case "$func" in - "--stdout") continue ;; - "--"*) break ;; - *) - case "${args[$((index + 1))]}" in "--"*) unset stdout_separator ;; esac - info "$func" - ;; - esac - index=$((index + 1)) - done - } + for func in "${args[@]}"; do + case "$func" in + "--"*) break ;; + *) + "get$func" 2>/dev/null + eval output="\$$func" + printf "$output " + ;; + esac + done + exit } # }}} @@ -2492,12 +2488,13 @@ while [ "$1" ]; do --stdout_separator) stdout_separator="$2" ;; --stdout_subtitles) stdout_subtitles="$2" ;; --stdout) + stdout="on" + unset info_color colors case "$2" in - "--"* | "") stdout="on" ;; - *) stdout="on"; args=("$@"); stdout ;; + "--"* | "") ;; + *) shift; args=("$@"); stdout ;; esac - unset info_color colors underline="off" image="off" color_blocks="off"