ascii: Added support for command output

This commit is contained in:
Dylan Araps 2019-01-07 18:04:25 +02:00
parent a52115b364
commit 1b356da175

View file

@ -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" ;;