pfetch: indent ascii

This commit is contained in:
Dylan Araps 2019-09-24 18:00:47 +03:00
parent 89be323ebf
commit 0f683ca022

64
pfetch
View File

@ -239,20 +239,40 @@ get_memory() {
}
get_ascii() {
# This is a simple function to read the contents of
# an ascii file from 'stdin'. It allows for the use
# of '<<-EOF' to prevent the break in indentation in
# this source code.
read_ascii() {
while IFS= read -r line; do
ascii="$ascii$line
"
done
}
# This checks for ascii art in the following order:
# '$1': Argument given to 'get_ascii()' directly.
# '$PF_ASCII': Environment variable set by user.
# '$distro': The detected distribution name.
# '$os': The name of the operating system/kernel.
#
# NOTE: Each ascii art below is indented using tabs, this
# allows indentation to continue naturally despite
# the use of '<<-EOF'.
case ${1:-${PF_ASCII:-${distro:-$os}}} in
[Aa]lpine*)
ascii="\
read_ascii <<-EOF
${c4} /\\ /\\
/${c7}/ ${c4}\\ \\
/${c7}/ ${c4}\\ \\
/${c7}// ${c4}\\ \\
${c7}// ${c4}\\ \\
\\
"
EOF
;;
[Aa]rch*)
ascii="\
read_ascii <<-EOF
${c6} /\\
/^^\\
/\\ \\
@ -260,22 +280,22 @@ ${c6} /\\
/ ( ) \\
/ __| |__\\\\
/// \\\\\\
"
EOF
;;
[Dd]ebian*)
ascii="\
read_ascii <<-EOF
${c1} _____
/ __ \\
| / |
| \\___-
-_
--_
"
EOF
;;
[Ff]edora*)
ascii="\
read_ascii <<-EOF
${c7} _____
/ __)${c4}\\${c7}
| / ${c4}\\ \\${c7}
@ -284,11 +304,11 @@ ${c7} _____
${c4}/ /${c7} | |
${c4}\\ \\${c7}__/ |
${c4}\\${c7}(_____/
"
EOF
;;
[Ff]ree[Bb][Ss][Dd]*)
ascii="\
read_ascii <<-EOF
${c1} /\\ _____ /\\
\\_) (_/
/ \\
@ -296,11 +316,11 @@ ${c1} /\\ _____ /\\
| |
\ /
--_____--
"
EOF
;;
[Gg]entoo*)
ascii="\
read_ascii <<-EOF
${c5} _-----_
( \\
\\ 0 \\
@ -308,11 +328,11 @@ ${c7} \\ )
/ _/
( _-
\\____-
"
EOF
;;
[Ll]inux*)
ascii="\
read_ascii <<-EOF
${c4} ___
(${c7}.· ${c4}|
(${c5}<> ${c4}|
@ -320,11 +340,11 @@ ${c4} ___
( ${c7}/ \\ ${c4}/|
${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4})
${c5}\/${c4}-____${c5}\/
"
EOF
;;
[Mm]ac[Oo][Ss]*)
ascii="\
read_ascii <<-EOF
${c1} .:'
_ :'_
${c2} .'\`_\`-'_\`\`.
@ -333,11 +353,11 @@ ${c3}:_______:
:_______:
${c4} :_______\`-;
${c5} \`._.-._.'
"
EOF
;;
[Nn]ix[Oo][Ss]*)
ascii="\
read_ascii <<-EOF
${c4} \\\\ \\\\ //
==\\\\__\\\\/ //
// \\\\//
@ -345,11 +365,11 @@ ${c4} \\\\ \\\\ //
//\\\\___//
// /\\\\ \\\\==
// \\\\ \\\\
"
EOF
;;
[Oo]pen[Bb][Ss][Dd]*)
ascii="\
read_ascii <<-EOF
${c3} _____
\\- -/
\\_/ \\
@ -357,11 +377,11 @@ ${c3} _____
|_ < ) 3 )
/ \\ /
/-_____-\\
"
EOF
;;
[Vv]oid*)
ascii="\
read_ascii <<-EOF
${c2} _______
_ \\______ -
| \\ ___ \\ |
@ -369,7 +389,7 @@ ${c2} _______
| | \___/ | |
| \\______ \\_|
-_______\\
"
EOF
;;
*)