pfetch: indent ascii

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

218
pfetch
View File

@ -239,137 +239,157 @@ get_memory() {
} }
get_ascii() { 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 case ${1:-${PF_ASCII:-${distro:-$os}}} in
[Aa]lpine*) [Aa]lpine*)
ascii="\ read_ascii <<-EOF
${c4} /\\ /\\ ${c4} /\\ /\\
/${c7}/ ${c4}\\ \\ /${c7}/ ${c4}\\ \\
/${c7}/ ${c4}\\ \\ /${c7}/ ${c4}\\ \\
/${c7}// ${c4}\\ \\ /${c7}// ${c4}\\ \\
${c7}// ${c4}\\ \\ ${c7}// ${c4}\\ \\
\\ \\
" EOF
;; ;;
[Aa]rch*) [Aa]rch*)
ascii="\ read_ascii <<-EOF
${c6} /\\ ${c6} /\\
/^^\\ /^^\\
/\\ \\ /\\ \\
/${c7} __ \\ /${c7} __ \\
/ ( ) \\ / ( ) \\
/ __| |__\\\\ / __| |__\\\\
/// \\\\\\ /// \\\\\\
" EOF
;; ;;
[Dd]ebian*) [Dd]ebian*)
ascii="\ read_ascii <<-EOF
${c1} _____ ${c1} _____
/ __ \\ / __ \\
| / | | / |
| \\___- | \\___-
-_ -_
--_ --_
" EOF
;; ;;
[Ff]edora*) [Ff]edora*)
ascii="\ read_ascii <<-EOF
${c7} _____ ${c7} _____
/ __)${c4}\\${c7} / __)${c4}\\${c7}
| / ${c4}\\ \\${c7} | / ${c4}\\ \\${c7}
${c4}__${c7}_| |_${c4}_/ /${c7} ${c4}__${c7}_| |_${c4}_/ /${c7}
${c4}/ ${c7}(_ _)${c4}_/${c7} ${c4}/ ${c7}(_ _)${c4}_/${c7}
${c4}/ /${c7} | | ${c4}/ /${c7} | |
${c4}\\ \\${c7}__/ | ${c4}\\ \\${c7}__/ |
${c4}\\${c7}(_____/ ${c4}\\${c7}(_____/
" EOF
;; ;;
[Ff]ree[Bb][Ss][Dd]*) [Ff]ree[Bb][Ss][Dd]*)
ascii="\ read_ascii <<-EOF
${c1} /\\ _____ /\\ ${c1} /\\ _____ /\\
\\_) (_/ \\_) (_/
/ \\ / \\
| | | |
| | | |
\ / \ /
--_____-- --_____--
" EOF
;; ;;
[Gg]entoo*) [Gg]entoo*)
ascii="\ read_ascii <<-EOF
${c5} _-----_ ${c5} _-----_
( \\ ( \\
\\ 0 \\ \\ 0 \\
${c7} \\ ) ${c7} \\ )
/ _/ / _/
( _- ( _-
\\____- \\____-
" EOF
;; ;;
[Ll]inux*) [Ll]inux*)
ascii="\ read_ascii <<-EOF
${c4} ___ ${c4} ___
(${c7}.· ${c4}| (${c7}.· ${c4}|
(${c5}<> ${c4}| (${c5}<> ${c4}|
/ ${c7}__ ${c4}\\ / ${c7}__ ${c4}\\
( ${c7}/ \\ ${c4}/| ( ${c7}/ \\ ${c4}/|
${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4}) ${c5}_${c4}/\\ ${c7}__)${c4}/${c5}_${c4})
${c5}\/${c4}-____${c5}\/ ${c5}\/${c4}-____${c5}\/
" EOF
;; ;;
[Mm]ac[Oo][Ss]*) [Mm]ac[Oo][Ss]*)
ascii="\ read_ascii <<-EOF
${c1} .:' ${c1} .:'
_ :'_ _ :'_
${c2} .'\`_\`-'_\`\`. ${c2} .'\`_\`-'_\`\`.
:________.-' :________.-'
${c3}:_______: ${c3}:_______:
:_______: :_______:
${c4} :_______\`-; ${c4} :_______\`-;
${c5} \`._.-._.' ${c5} \`._.-._.'
" EOF
;; ;;
[Nn]ix[Oo][Ss]*) [Nn]ix[Oo][Ss]*)
ascii="\ read_ascii <<-EOF
${c4} \\\\ \\\\ // ${c4} \\\\ \\\\ //
==\\\\__\\\\/ // ==\\\\__\\\\/ //
// \\\\// // \\\\//
==// //== ==// //==
//\\\\___// //\\\\___//
// /\\\\ \\\\== // /\\\\ \\\\==
// \\\\ \\\\ // \\\\ \\\\
" EOF
;; ;;
[Oo]pen[Bb][Ss][Dd]*) [Oo]pen[Bb][Ss][Dd]*)
ascii="\ read_ascii <<-EOF
${c3} _____ ${c3} _____
\\- -/ \\- -/
\\_/ \\ \\_/ \\
| ${c7}O O${c3} | | ${c7}O O${c3} |
|_ < ) 3 ) |_ < ) 3 )
/ \\ / / \\ /
/-_____-\\ /-_____-\\
" EOF
;; ;;
[Vv]oid*) [Vv]oid*)
ascii="\ read_ascii <<-EOF
${c2} _______ ${c2} _______
_ \\______ - _ \\______ -
| \\ ___ \\ | | \\ ___ \\ |
| | / \ | | | | / \ | |
| | \___/ | | | | \___/ | |
| \\______ \\_| | \\______ \\_|
-_______\\ -_______\\
" EOF
;; ;;
*) *)