From 1b356da175e030a3170f524d2d0cf7e95655a5ac Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 7 Jan 2019 18:04:25 +0200 Subject: [PATCH] ascii: Added support for command output --- neofetch | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/neofetch b/neofetch index 5f1eb181..6ced94d3 100755 --- a/neofetch +++ b/neofetch @@ -3418,8 +3418,9 @@ image_backend() { get_ascii() { if [[ -f "$image_source" && ! "$image_source" =~ (png|jpg|jpeg|jpe|svg|gif) ]]; then ascii_data="$(< "$image_source")" - else - err "Ascii: Ascii file not found, using distro ascii." + + elif [[ "$image_source" != "auto" ]]; then + ascii_data="$image_source" fi # Set locale to get correct padding. @@ -3430,6 +3431,9 @@ get_ascii() { ((++lines,${#line}>ascii_length)) && ascii_length="${#line}" done <<< "${ascii_data//\$\{??\}}" + # Fallback if file not found. + ((lines==1)) && { image_source="auto"; get_distro_ascii; get_ascii; return; } + # Colors. ascii_data="${ascii_data//\$\{c1\}/$c1}" ascii_data="${ascii_data//\$\{c2\}/$c2}" @@ -4595,7 +4599,6 @@ get_args() { "--ascii_distro") image_backend="ascii" ascii_distro="$2" - case "$2" in "-"* | "") ascii_distro="$distro" ;; esac ;; "--ascii_bold") ascii_bold="$2" ;;