diff --git a/Cargo.toml b/Cargo.toml index 21b9a91..7ccad17 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,6 @@ default = ["web"] # Enabling this feature indicates that the wasm32-unknown-unknown target should # be assumed to be in a web environment where it can call DOM APIs. web = ["web-sys", "wasm-bindgen"] + +[dependencies] +is-terminal = "0.4.10" diff --git a/src/disp.rs b/src/disp.rs new file mode 100644 index 0000000..a07538c --- /dev/null +++ b/src/disp.rs @@ -0,0 +1,273 @@ +/// Returns a reference to a static string containing the ASCII art +/// representation of the Windows logo. +pub fn display_windows() -> &'static str { + r#" + .oodMMMM + .oodMMMMMMMMMMMMM + ..oodMMM MMMMMMMMMMMMMMMMMMM + oodMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM .----------------. .----------------. .-----------------. .----------------. .----------------. .----------------. .----------------. + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | + | | _____ _____ | || | _____ | || | ____ _____ | || | ________ | || | ____ | || | _____ _____ | || | _______ | | + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM | ||_ _||_ _|| || | |_ _| | || ||_ \|_ _| | || | |_ ___ `. | || | .' `. | || ||_ _||_ _|| || | / ___ | | | + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM | | | | /\ | | | || | | | | || | | \ | | | || | | | `. \ | || | / .--. \ | || | | | /\ | | | || | | (__ \_| | | + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM | | | |/ \| | | || | | | | || | | |\ \| | | || | | | | | | || | | | | | | || | | |/ \| | | || | '.___`-. | | + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM | | | /\ | | || | _| |_ | || | _| |_\ |_ | || | _| |___.' / | || | \ `--' / | || | | /\ | | || | |`\____) | | | + MMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMM | | |__/ \__| | || | |_____| | || ||_____|\____| | || | |________.' | || | `.____.' | || | |__/ \__| | || | |_______.' | | + `^^^^^^MMMMMMM MMMMMMMMMMMMMMMMMMM | | | || | | || | | || | | || | | || | | || | | | + ````^^^^ ^^MMMMMMMMMMMMMMMMM | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | + ````^^^^^^MMMM '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' +"# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the BSD logo. +pub fn display_bsd() -> &'static str { + r#" + , , + /( )` + \ \___ / | + /- _ `-/ ' + (/\/ \ \ /\ + / / | ` \ + O O ) / | + `-^--'`< ' + (_.) _ ) / .----------------. .----------------. .----------------. + `.___/` / | .--------------. || .--------------. || .--------------. | + `-----' / | | ______ | || | _______ | || | ________ | | + <----. __ / __ \ | | |_ _ \ | || | / ___ | | || | |_ ___ `. | | + <----|====O)))==) \) /==== | | | |_) | | || | | (__ \_| | || | | | `. \ | | + <----' `--' `.__,' \ | | | __'. | || | '.___`-. | || | | | | | | | + | | | | _| |__) | | || | |`\____) | | || | _| |___.' / | | + \ / | | |_______/ | || | |_______.' | || | |________.' | | + ______( (_ / \______ | | | || | | || | | | + ,' ,-----' | \ | '--------------' || '--------------' || '--------------' | + `--{__________) \/ '----------------' '----------------' '----------------' +"# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the MacOS logo. +pub fn display_macos() -> &'static str { + r#" + ,xNMM. + .OMMMMo + lMM" + .;loddo:. .olloddol;. + cKMMMMMMMMMMNWMMMMMMMMMM0: + .KMMMMMMMMMMMMMMMMMMMMMMMWd. .----------------. .----------------. .----------------. .----------------. .----------------. + XMMMMMMMMMMMMMMMMMMMMMMMX. | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | +;MMMMMMMMMMMMMMMMMMMMMMMM: | | ____ ____ | || | __ | || | ______ | || | ____ | || | _______ | | +:MMMMMMMMMMMMMMMMMMMMMMMM: | ||_ \ / _|| || | / \ | || | .' ___ | | || | .' `. | || | / ___ | | | +.MMMMMMMMMMMMMMMMMMMMMMMMX. | | | \/ | | || | / /\ \ | || | / .' \_| | || | / .--. \ | || | | (__ \_| | | + kMMMMMMMMMMMMMMMMMMMMMMMMWd. | | | |\ /| | | || | / ____ \ | || | | | | || | | | | | | || | '.___`-. | | + 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk | | _| |_\/_| |_ | || | _/ / \ \_ | || | \ `.___.'\ | || | \ `--' / | || | |`\____) | | | + 'XMMMMMMMMMMMMMMMMMMMMMMMMK. | ||_____||_____|| || ||____| |____|| || | `._____.' | || | `.____.' | || | |_______.' | | + kMMMMMMMMMMMMMMMMMMMMMMd | | | || | | || | | || | | || | | | + ;KMMMMMMMWXXWMMMMMMMk. | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | + "cooc*" "*coo' '----------------' '----------------' '----------------' '----------------' '----------------' +"# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Illumos logo. +pub fn display_illumos() -> &'static str { + r#" +' Tw + `h||hnN + \P|||I$N + `P|||$IK, + `%wb$$IPK, + .*b|I$PPKp + `TP@|$KPPKp + `%wwI@K$PPPKw ,pKKKKm>. + "Tb@|$KPPPPKp pPPPK" + "TK@@@@K$PPPPKp,,bPPK + -wppP$$$$PPPPPPPPPPb + ,,pbP$$PPPPPPPPPP + ,,$pPPPPPPPPPPP .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. .----------------. + ,pKKPPPPPPPPPL | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | + -<4PPPPPPPP | | _____ | || | _____ | || | _____ | || | _____ _____ | || | ____ ____ | || | ____ | || | _______ | | + PPPPPP` | | |_ _| | || | |_ _| | || | |_ _| | || ||_ _||_ _|| || ||_ \ / _|| || | .' `. | || | / ___ | | | + /KPPPM/ | | | | | || | | | | || | | | | || | | | | | | || | | \/ | | || | / .--. \ | || | | (__ \_| | | + ,pKPPPM` | | | | | || | | | _ | || | | | _ | || | | ' ' | | || | | |\ /| | | || | | | | | | || | '.___`-. | | + ,,pKK$PPM | | _| |_ | || | _| |__/ | | || | _| |__/ | | || | \ `--' / | || | _| |_\/_| |_ | || | \ `--' / | || | |`\____) | | | + '''''qK9K | | |_____| | || | |________| | || | |________| | || | `.__.' | || ||_____||_____|| || | `.____.' | || | |_______.' | | + ,p#M",#" | | | || | | || | | || | | || | | || | | || | | | + `` ,pM` | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | + '` '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' + "# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the iOS logo. +pub fn display_ios() -> &'static str { + r#" + ,xNMM. + .OMMMMo + lMM" + .;loddo:. .olloddol;. + cKMMMMMMMMMMNWMMMMMMMMMM0: + .KMMMMMMMMMMMMMMMMMMMMMMMWd. .----------------. .----------------. .----------------. + XMMMMMMMMMMMMMMMMMMMMMMMX. | .--------------. || .--------------. || .--------------. | +;MMMMMMMMMMMMMMMMMMMMMMMM: | | _____ | || | ____ | || | _______ | | +:MMMMMMMMMMMMMMMMMMMMMMMM: | | |_ _| | || | .' `. | || | / ___ | | | +.MMMMMMMMMMMMMMMMMMMMMMMMX. | | | | | || | / .--. \ | || | | (__ \_| | | + kMMMMMMMMMMMMMMMMMMMMMMMMWd. | | | | | || | | | | | | || | '.___`-. | | + 'XMMMMMMMMMMMMMMMMMMMMMMMMMMk | | _| |_ | || | \ `--' / | || | |`\____) | | | + 'XMMMMMMMMMMMMMMMMMMMMMMMMK. | | |_____| | || | `.____.' | || | |_______.' | | + kMMMMMMMMMMMMMMMMMMMMMMd | | | || | | || | | | + ;KMMMMMMMWXXWMMMMMMMk. | '--------------' || '--------------' || '--------------' | + "cooc*" "*coo' '----------------' '----------------' '----------------' +"# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Android logo. +pub fn display_android() -> &'static str { + r#" + -o o- + +hydNNNNdyh+ + +mMMMMMMMMMMMMm+ + `dMMm:NMMMMMMN:mMMd` + hMMMMMMMMMMMMMMMMMMh + .. yyyyyyyyyyyyyyyyyyyy .. +.mMMm`MMMMMMMMMMMMMMMMMMMM`mMMm. +:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: .----------------. .-----------------. .----------------. .----------------. .----------------. .----------------. .----------------. +:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | +:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: | | __ | || | ____ _____ | || | ________ | || | _______ | || | ____ | || | _____ | || | ________ | | +:MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM: | | / \ | || ||_ \|_ _| | || | |_ ___ `. | || | |_ __ \ | || | .' `. | || | |_ _| | || | |_ ___ `. | | +-MMMM-MMMMMMMMMMMMMMMMMMMM-MMMM- | | / /\ \ | || | | \ | | | || | | | `. \ | || | | |__) | | || | / .--. \ | || | | | | || | | | `. \ | | + +yy+ MMMMMMMMMMMMMMMMMMMM +yy+ | | / ____ \ | || | | |\ \| | | || | | | | | | || | | __ / | || | | | | | | || | | | | || | | | | | | | + mMMMMMMMMMMMMMMMMMMm | | _/ / \ \_ | || | _| |_\ |_ | || | _| |___.' / | || | _| | \ \_ | || | \ `--' / | || | _| |_ | || | _| |___.' / | | + `/++MMMMh++hMMMM++/` | ||____| |____|| || ||_____|\____| | || | |________.' | || | |____| |___| | || | `.____.' | || | |_____| | || | |________.' | | + MMMMo oMMMM | | | || | | || | | || | | || | | || | | || | | | + MMMMo oMMMM | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | + oNMm- -mMNs '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' +"# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Nintendo logo. +pub fn display_nintendo() -> &'static str { + r#" + .-----------------. .----------------. .-----------------. .----------------. .----------------. .-----------------. .----------------. .----------------. + | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | + | | ____ _____ | || | _____ | || | ____ _____ | || | _________ | || | _________ | || | ____ _____ | || | ________ | || | ____ | | + | ||_ \|_ _| | || | |_ _| | || ||_ \|_ _| | || | | _ _ | | || | |_ ___ | | || ||_ \|_ _| | || | |_ ___ `. | || | .' `. | | +⠀⠀⠀⣀⣤⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣤⡀⠀⠀⠀ | | | \ | | | || | | | | || | | \ | | | || | |_/ | | \_| | || | | |_ \_| | || | | \ | | | || | | | `. \ | || | / .--. \ | | +⠀⣠⣾⡿⠛⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠻⣿⣷⡀ | | | |\ \| | | || | | | | || | | |\ \| | | || | | | | || | | _| _ | || | | |\ \| | | || | | | | | | || | | | | | | |⠀ +⢰⣿⡏⠀⠀ ⣶⣶⣆⠀⠀⣶⣶⠀⢰⣶⡆⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⣶⣶⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄ | | | |\ \| | | || | | | | || | | |\ \| | | || | | | | || | | _| _ | || | | |\ \| | | || | | | | | | || | | | | | | | +⣿⣿⠀⠀⠀⠀⣿⣿⢿⣧⡀⣿⣿⠀⢰⣶⡆⢰⣶⣦⠴⢶⣦⡄⠛⣿⣿⠛⢀⣤⡖⠒⣶⣄⠀⣴⣶⡦⠶⣶⣦⡀⢀⣴⡶⠶⣿⣿⠀⢠⣴⡖⠒⣦⡄⠀⠀⠸⣿⡇ | | _| |_\ |_ | || | _| |_ | || | _| |_\ |_ | || | _| |_ | || | _| |___/ | | || | _| |_\ |_ | || | _| |___.' / | || | \ `--' / | | +⣿⣿⠀⠀⠀⠀⣿⣿⠀⢻⣿⣿⣿⠀⢸⣿⡇⢸⣿⡏⠀⠈⣿⣿⠀⣿⣿⠀⢾⣿⡟⠛⠛⠛⠂⣿⣿⡇⠀⢸⣿⡇⢸⣿⡇⠀⣿⣿⠀⣿⣿⠀⠀⣿⣿⠀⠀⢠⣿⡇ | ||_____|\____| | || | |_____| | || ||_____|\____| | || | |_____| | || | |_________| | || ||_____|\____| | || | |________.' | || | `.____.' | | +⠸⣿⣇⠀⠀⠀⠿⠿⠀⠀⠹⠿⠿⠀⠸⠿⠇⠸⠿⠇⠀⠠⠿⠿⠀⠿⠿⠀⠈⠻⠧⠤⠿⠟⠀⠿⠿⠇⠀⠸⠿⠇⠘⠿⣧⡤⠿⠿⠀⠘⠿⠧⠴⠿⠋⠀⢀⣾⣿⠃ | | | || | | || | | || | | || | | || | | || | | || | | | +⠀⠙⢿⣷⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣴⣿⡿⠁⠀ | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | +⠀⠀⠀⠉⠛⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠛⠉ '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' '----------------' + "# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Xbox logo. +pub fn display_xbox() -> &'static str { + r#" +⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣶⣶⣶⣶⣤⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⡀⠀⠈⠉⠛⠿⣿⣿⣿⣿⠿⠛⠉⠁⠀⢀⠀⠀⠀⠀⠀ +⠀⠀⠀⣴⣿⣿⣿⣶⣄⡀⠀⠈⠙⠋⠁⠀⢀⣠⣶⣿⣿⣿⣦⠀⠀⠀ .----------------. .----------------. .----------------. .----------------. +⠀⢀⣾⣿⣿⣿⣿⣿⣿⡿⠂⠀⠀⠀⠀⠐⢿⣿⣿⣿⣿⣿⣿⣷⡀⠀ | .--------------. || .--------------. || .--------------. || .--------------. | +⠀⣾⣿⣿⣿⣿⣿⣿⠋⠀⠀⠀⢀⡀⠀⠀⠀⠙⣿⣿⣿⣿⣿⣿⣷⠀ | | ____ ____ | || | ______ | || | ____ | || | ____ ____ | | +⢠⣿⣿⣿⣿⣿⡟⠁⠀⠀⢀⣴⣿⣿⣦⡀⠀⠀⠈⢻⣿⣿⣿⣿⣿⡄ | | |_ _||_ _| | || | |_ _ \ | || | .' `. | || | |_ _||_ _| | | +⢸⣿⣿⣿⣿⠏⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣦⡀⠀⠀⠹⣿⣿⣿⣿⡇ | | \ \ / / | || | | |_) | | || | / .--. \ | || | \ \ / / | | +⠘⣿⣿⣿⠏⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠹⣿⣿⣿⠃ | | > `' < | || | | __'. | || | | | | | | || | > `' < | | +⠀⢿⣿⡟⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⡀⠀⢻⣿⡿⠀ | | _/ /'`\ \_ | || | _| |__) | | || | \ `--' / | || | _/ /'`\ \_ | | +⠀⠈⢿⡇⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡄⢸⡿⠁⠀ | | |____||____| | || | |_______/ | || | `.____.' | || | |____||____| | | +⠀⠀⠀⠃⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠘⠀⠀ | | | || | | || | | || | | | +⠀⠀⠀⠀⠈⠛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀⠀⠀⠀ | '--------------' || '--------------' || '--------------' || '--------------' | +⠀⠀⠀⠀⠀⠀⠀⠈⠙⠛⠛⠿⠿⠿⠿⠛⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀ '----------------' '----------------' '----------------' '----------------' + "# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Playstation logo. +pub fn display_playstation() -> &'static str { + r#" +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣷⣶⣤⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⠿⣿⣷⣶⣄⠀⠀⠀⠀⠀ .----------------. .----------------. +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀ | .--------------. || .--------------. | +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀⠀ | | ______ | || | _______ | | +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣿⡿⠀⠀⠀⠀ | | |_ __ \ | || | / ___ | | | +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣿⡿⠀⠀⠀⠀⠀⠀ | | | |__) | | || | | (__ \_| | | +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⡇⠀⢸⣿⣿⣿⣿⠇⠀⠀⠀⠀ | | | ___/ | || | '.___`-. | | +⠀⠀⠀⠀⠀⠀⠀⣀⣤⠀⣿⣿⣿⣿⡇⠀⠈⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀ | | _| |_ | || | |`\____) | | | +⠀⢀⣠⣤⣶⣾⣿⣿⡿⠀⣿⣿⣿⣿⡇⠀⢰⣶⣿⣿⣿⠿⠿⢿⣶⣦⣤⡀ | | |_____| | || | |_______.' | | +⢰⣿⣿⣿⡿⠛⠉⢀⣀⠀⣿⣿⣿⣿⡇⠀⠘⠋⠉⠀⣀⣠⣴⣾⣿⣿⣿⠇ | | | || | | | +⠈⠻⠿⣿⣿⣿⣿⣿⠿⠀⣿⣿⣿⣿⡇⠀⢠⣶⣾⣿⣿⡿⠿⠟⠋⠉⠀⠀ | '--------------' || '--------------' | +⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠛⠿⢿⡇⠀⠸⠟⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀ '----------------' '----------------' + "# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Redox logo. +pub fn display_redox() -> &'static str { + r#" + ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄ ▄ ▄ + ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ + ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀▀▀ ▐░█▀▀▀▀▀▀▀█░▌▐░█▀▀▀▀▀▀▀█░▌ ▐░▌ ▐░▌ + ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ + ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄▄▄ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▐░▌ + ▐░░░░░░░░░░░▌▐░░░░░░░░░░░▌▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ + ▐░█▀▀▀▀█░█▀▀ ▐░█▀▀▀▀▀▀▀▀▀ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌░▌ + ▐░▌ ▐░▌ ▐░▌ ▐░▌ ▐░▌▐░▌ ▐░▌ ▐░▌ ▐░▌ + ▐░▌ ▐░▌ ▐░█▄▄▄▄▄▄▄▄▄ ▐░█▄▄▄▄▄▄▄█░▌▐░█▄▄▄▄▄▄▄█░▌ ▐░▌ ▐░▌ + ▐░▌ ▐░▌▐░░░░░░░░░░░▌▐░░░░░░░░░░▌ ▐░░░░░░░░░░░▌▐░▌ ▐░▌ + ▀ ▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀ ▀ ▀ + "# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Fuchsia logo. +pub fn display_fuchsia() -> &'static str { + r#" + ▄████ ▄█▄ ▄ █ ▄▄▄▄▄ ▄█ ██ + █▀ █▀ ▀▄ █ █ █ ▀▄ ██ █ █ + █▀▀ █ █ █ ▀ ██▀▀█ ▄ ▀▀▀▀▄ ██ █▄▄█ + █ █ █ █▄ ▄▀ █ █ ▀▄▄▄▄▀ ▐█ █ █ + █ █▄ ▄█ ▀███▀ █ ▐ █ + ▀ ▀▀▀ ▀ █ + ▀ + "# +} + +/// Returns a reference to a static string containing the ASCII art +/// representation of the Linux logo. +pub fn display_linux() -> &'static str { + r#" + .88888888:. + 88888888.88888. + .8888888888888888. + 888888888888888888 + 88' _`88'_ `88888 + 88 88 88 88 88888 + 88_88_::_88_:88888 + 88:::,::,:::::8888 + 88`:::::::::'`8888 + .88 `::::' 8:88. + 8888 `8:888. + .8888' `888888. + .8888:.. .::. ...:'8888888:. + .8888.' :' `'::`88:88888 + .8888 ' `.888:8888. + 888:8 . 888:88888 .----------------. .----------------. .-----------------. .----------------. .----------------. + .888:88 .: 888:88888: | .--------------. || .--------------. || .--------------. || .--------------. || .--------------. | + 8888888. :: 88:888888 | | _____ | || | _____ | || | ____ _____ | || | _____ _____ | || | ____ ____ | | + `.::.888. :: .88888888 | | |_ _| | || | |_ _| | || ||_ \|_ _| | || ||_ _||_ _|| || | |_ _||_ _| | | + .::::::.888. :: :::`8888'.:. | | | | | || | | | | || | | \ | | | || | | | | | | || | \ \ / / | | + ::::::::::.888 ' .:::::::::::: | | | | _ | || | | | | || | | |\ \| | | || | | ' ' | | || | > `' < | | + ::::::::::::.8 ' .:8::::::::::::. | | _| |__/ | | || | _| |_ | || | _| |_\ |_ | || | \ `--' / | || | _/ /'`\ \_ | | + .::::::::::::::. .:888::::::::::::: | | |________| | || | |_____| | || ||_____|\____| | || | `.__.' | || | |____||____| | | + :::::::::::::::88:.__..:88888:::::::::::' | | | || | | || | | || | | || | | | + `'.:::::::::::88888888888.88:::::::::' | '--------------' || '--------------' || '--------------' || '--------------' || '--------------' | + `':::_:' -- '' -'-' `':_::::'` '----------------' '----------------' '----------------' '----------------' '----------------' +"# +} diff --git a/src/lib.rs b/src/lib.rs index 49ce2d0..ae3b769 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -71,6 +71,8 @@ const DEFAULT_USERNAME: &str = "Unknown"; const DEFAULT_HOSTNAME: &str = "LocalHost"; +#[allow(missing_docs)] +pub mod disp; pub mod fallible; #[allow(unsafe_code)] @@ -116,6 +118,8 @@ use std::{ io::{Error, ErrorKind}, }; +use is_terminal::IsTerminal; + /// This crate's convenience type alias for [`Result`](std::result::Result)s pub type Result = std::result::Result; @@ -297,25 +301,25 @@ pub enum Platform { impl Display for Platform { fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { - if let Self::Unknown(_) = self { - f.write_str("Unknown: ")?; + if std::io::stdout().is_terminal() { + f.write_str(match self { + Self::Linux => disp::display_linux(), + Self::Bsd => disp::display_bsd(), + Self::Windows => disp::display_windows(), + Self::MacOS => disp::display_macos(), + Self::Illumos => disp::display_illumos(), + Self::Ios => disp::display_ios(), + Self::Android => disp::display_android(), + Self::Nintendo => disp::display_nintendo(), + Self::Xbox => disp::display_xbox(), + Self::PlayStation => disp::display_playstation(), + Self::Fuchsia => disp::display_fuchsia(), + Self::Redox => disp::display_redox(), + Self::Unknown(a) => a, + }) + } else { + write!(f, "{:?}", self) } - - f.write_str(match self { - Self::Linux => "Linux", - Self::Bsd => "BSD", - Self::Windows => "Windows", - Self::MacOS => "Mac OS", - Self::Illumos => "Illumos", - Self::Ios => "iOS", - Self::Android => "Android", - Self::Nintendo => "Nintendo", - Self::Xbox => "XBox", - Self::PlayStation => "PlayStation", - Self::Fuchsia => "Fuchsia", - Self::Redox => "Redox", - Self::Unknown(a) => a, - }) } }