Reduce size of 'ascii' function

This commit is contained in:
Dylan 2016-02-16 20:58:06 +11:00
parent 4a0f02bde7
commit 31e7057fbc
1 changed files with 37 additions and 77 deletions

114
fetch
View File

@ -1605,163 +1605,114 @@ getascii () {
shopt -s nocasematch shopt -s nocasematch
case "$ascii_distro" in case "$ascii_distro" in
"Arch Linux"* | "Antergos"*) "Arch Linux"* | "Antergos"*)
c1=$(color 6) ascii_colors 6 4
c2=$(color 4)
;; ;;
"CentOS"*) "CentOS"*)
c1=$(color 3) ascii_colors 3 2 4 5 7
c2=$(color 2)
c3=$(color 4)
c4=$(color 5)
c5=$(color 7)
;; ;;
"CRUX"* | "Chakra"* | "gNewSense"*) "CRUX"* | "Chakra"* | "gNewSense"*)
c1=$(color 4) ascii_colors 4 5 7
c2=$(color 5)
c3=$(color 7)
;; ;;
"Debian"* | "FreeBSD"* | "Elementary"* | "CrunchBang"* | "Ubuntu"*) "Debian"* | "FreeBSD"* | "Elementary"* | "CrunchBang"* | "Ubuntu"*)
c1=$(color 7) ascii_colors 7 1 3
c2=$(color 1)
c3=$(color 3)
;; ;;
"Red Hat"*) "Red Hat"*)
c1=$(color 7) ascii_colors 7 1 3
c2=$(color 1)
c3=$(color 3)
ascii_distro="redhat" ascii_distro="redhat"
;; ;;
"Exherbo"*) "Fedora"* | "Sabayon"* | "Frugalware"* | "Exherbo"*)
c1=$(color 7) ascii_colors 7 4 1
c2=$(color 4)
c3=$(color 1)
;;
"Fedora"* | "Sabayon"* | "Frugalware"*)
c1=$(color 7)
c2=$(color 4)
;; ;;
"Gentoo"* | "Funtoo"*) "Gentoo"* | "Funtoo"*)
c1=$(color 7) ascii_colors 7 5
c2=$(color 5)
;; ;;
"Kali"*) "Kali"*)
c1=$(color 4) ascii_colors 4 8
c2=$(color 8)
;; ;;
"KaOS"*) "KaOS"*)
c1=$(color 4) ascii_colors 4 7 1
c2=$(color 7)
c3=$(color 1)
;; ;;
"Mac OS X"* | "Manjaro"* | "Deepin"*) "Mac OS X"* | "Manjaro"* | "Deepin"*)
c1=$(color 2) ascii_colors 2 3 1 1 5 4
c2=$(color 3)
c3=$(color 1)
c4=$(color 1)
c5=$(color 5)
c6=$(color 4)
;; ;;
"OpenMandriva"*) "OpenMandriva"*)
c1=$(color 4) ascii_colors 4 3
c2=$(color 3)
;; ;;
"Mageia"*) "Mageia"*)
c1=$(color 7) ascii_colors 7 6
c2=$(color 6)
;; ;;
"Peppermint"*) "Peppermint"*)
c1=$(color 7) ascii_colors 7 1
c2=$(color 1)
;; ;;
*"Mint"*) *"Mint"*)
c1=$(color 7) ascii_colors 7 2
c2=$(color 2)
ascii_distro="mint" ascii_distro="mint"
;; ;;
"LMDE"* | "Chapeau"*) "LMDE"* | "Chapeau"*)
c1=$(color 7) ascii_colors 7 2
c2=$(color 2)
;; ;;
"NetBSD"* | "Parabola"* | "Tails"* | "BLAG"*) "NetBSD"* | "Parabola"* | "Tails"* | "BLAG"*)
c1=$(color 5) ascii_colors 5 7
c2=$(color 7)
;; ;;
"OpenBSD"*) "OpenBSD"*)
c1=$(color 3) ascii_colors 3 3 6 1 8
c2=$(color 3)
c3=$(color 6)
c4=$(color 1)
c5=$(color 8)
;; ;;
"OpenSuse"*) "OpenSuse"*)
c1=$(color 2) ascii_colors 2 7
c2=$(color 7)
;; ;;
"PCLinuxOS"* | "Slackware"*) "PCLinuxOS"* | "Slackware"*)
c1=$(color 4) ascii_colors 4 7
c2=$(color 7)
;; ;;
"Raspbian"*) "Raspbian"*)
c1=$(color 2) ascii_colors 2 1
c2=$(color 1)
;; ;;
"Scientific"*) "Scientific"*)
c1=$(color 4) ascii_colors 4 1 7
c2=$(color 1)
c3=$(color 7)
;; ;;
"Solus"*) "Solus"*)
c1=$(color 7) ascii_colors 7 8
c2=$(color 8)
;; ;;
"Trisquel"* | "NixOS"*) "Trisquel"* | "NixOS"*)
c1=$(color 4) ascii_colors 4 6
c2=$(color 6)
;; ;;
"void"*) "void"*)
c1=$(color 2) ascii_colors 2 2 8
c2=$(color 2)
c3=$(color 8)
;; ;;
"Windows 10"*) "Windows 10"*)
c1=$(color 6) ascii_colors 6
ascii_distro="windows10" ascii_distro="windows10"
;; ;;
"Windows"*) "Windows"*)
c1=$(color 1) ascii_colors 1 2 4 3
c2=$(color 2)
c3=$(color 4)
c4=$(color 3)
;; ;;
"Zorin"*) "Zorin"*)
c1=$(color 4) ascii_colors 4
;; ;;
esac esac
@ -1843,6 +1794,15 @@ getascii () {
export LC_ALL=C export LC_ALL=C
} }
ascii_colors () {
c1=$(color "$1")
c2=$(color "$2")
c3=$(color "$3")
c4=$(color "$4")
c5=$(color "$5")
c6=$(color "$6")
}
# }}} # }}}