Skip to content

Commit c6fde1f

Browse files
committed
ascii: Simplify function.
1 parent b93eb5a commit c6fde1f

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

neofetch

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3418,17 +3418,8 @@ image_backend() {
34183418
}
34193419

34203420
get_ascii() {
3421-
if [[ ! -f "$image_source" ||
3422-
"$image_source" =~ ^(auto|ascii)$ ||
3423-
"$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]]; then
3424-
3425-
# Fallback to distro ascii mode if custom ascii isn't found.
3426-
[[ ! "$image_source" =~ ^(auto|ascii)$ ]] && \
3427-
err "Ascii: Ascii file not found, using distro ascii."
3428-
3429-
# Fallback to distro ascii mode if source is an image.
3430-
[[ "$image_source" =~ \.(png|jpg|jpe|jpeg|gif)$ ]] && \
3431-
err "Image: Source is image file but ascii backend was selected. Using distro ascii."
3421+
if [[ ! -f "$image_source" ]]; then
3422+
err "Ascii: Ascii file not found, using distro ascii."
34323423
else
34333424
ascii_data="$(< "$image_source")"
34343425
fi
@@ -3458,10 +3449,7 @@ get_ascii() {
34583449
print="${print//'${c5}'/$c5}"
34593450
print="${print//'${c6}'/$c6}"
34603451

3461-
# Overwrite padding if ascii_length_force is set.
3462-
[[ "$ascii_length_force" ]] && ascii_length="$ascii_length_force"
3463-
3464-
text_padding="$((ascii_length + gap))"
3452+
((text_padding=ascii_length+gap))
34653453
printf "%b" "$print"
34663454
LC_ALL=C
34673455
}

0 commit comments

Comments
 (0)