Merge branch 'master' of gitea.tforgione.fr:tforgione/tfetch

This commit is contained in:
Thomas Forgione 2019-12-12 14:27:00 +01:00
commit a0536a9503
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
3 changed files with 24 additions and 1 deletions

View File

@ -25,8 +25,11 @@ impl Os {
pub fn detect() -> Option<Os> { pub fn detect() -> Option<Os> {
let lsb_release = lsb_release().unwrap(); let lsb_release = lsb_release().unwrap();
Os::from_str(lsb_release.trim())
}
match lsb_release.trim() { pub fn from_str(os: &str) -> Option<Os> {
match os {
"archlinux" | "Arch Linux" | "arch" | "Arch" | "archarm" => Some(Os::ArchLinux), "archlinux" | "Arch Linux" | "arch" | "Arch" | "archarm" => Some(Os::ArchLinux),
"Debian" => Some(Os::Debian), "Debian" => Some(Os::Debian),
"ManjaroLinux" => Some(Os::Manjaro), "ManjaroLinux" => Some(Os::Manjaro),
@ -42,6 +45,7 @@ impl Os {
match self { match self {
Os::ArchLinux => logos::archlinux::ASCII_LOGO, Os::ArchLinux => logos::archlinux::ASCII_LOGO,
Os::Ubuntu => logos::ubuntu::ASCII_LOGO, Os::Ubuntu => logos::ubuntu::ASCII_LOGO,
Os::Debian => logos::debian::ASCII_LOGO,
_ => unimplemented!(), _ => unimplemented!(),
} }
} }
@ -58,6 +62,7 @@ impl Os {
match self { match self {
Os::ArchLinux => "\x1B[36;1m", Os::ArchLinux => "\x1B[36;1m",
Os::Ubuntu => "\x1B[31;1m", Os::Ubuntu => "\x1B[31;1m",
Os::Debian => "\x1B[31;1m",
_ => unimplemented!(), _ => unimplemented!(),
} }
} }

17
src/logos/debian.rs Normal file
View File

@ -0,0 +1,17 @@
pub const ASCII_LOGO: &'static str = " \x1B[1m_,met$$$$$gg._\x1B[0m \
\n \x1B[1m,g$$$$$$$$$$$$$$$P.\x1B[0m \
\n \x1B[1m,g$$P\"\"\x1B[0m \x1B[1m\"\"\"Y$$.\".\x1B[0m \
\n \x1B[1m,$$P'\x1B[0m \x1B[1m`$$$.\x1B[0m \
\n \x1B[1m',$$P\x1B[0m \x1B[1m,ggs.\x1B[0m \x1B[1m`$$b:\x1B[0m \
\n \x1B[1m`d$$'\x1B[0m \x1B[1m,$P\"\'\x1B[0m \x1B[31;1m.\x1B[0m \x1B[1m$$$\x1B[0m \
\n \x1B[1m$$P\x1B[0m \x1B[1md$\'\x1B[0m \x1B[31;1m,\x1B[0m \x1B[1m$$P\x1B[0m \
\n \x1B[1m$$:\x1B[0m \x1B[1m$$.\x1B[0m \x1B[31;1m-\x1B[0m \x1B[1m,d$$'\x1B[0m \
\n \x1B[1m$$;\x1B[0m \x1B[1mY$b._\x1B[0m _\x1B[1m,d$P'\x1B[0m \
\n \x1B[1mY$$.\x1B[0m \x1B[31;1m`.\x1B[0;1m`\"Y$$$$P\"'\x1B[0m \
\n \x1B[1m`$$b\x1B[0m \x1B[31;1m\"-.__\x1B[0m \
\n \x1B[1m`Y$$\x1B[0m \
\n \x1B[1m`Y$$.\x1B[0m \
\n \x1B[1m`$$b.\x1B[0m \
\n \x1B[1m`Y$$b.\x1B[0m \
\n \x1B[1m`\"Y$b._\x1B[0m \
\n \x1B[1m`\"\"\"\"\x1B[0m ";

View File

@ -1,2 +1,3 @@
pub mod archlinux; pub mod archlinux;
pub mod ubuntu; pub mod ubuntu;
pub mod debian;