33 lines
869 B
Rust
33 lines
869 B
Rust
use std::env::var;
|
|
use std::fs::File;
|
|
use std::io::Read;
|
|
|
|
use tfetch::Os;
|
|
|
|
pub fn main() {
|
|
|
|
let mut hostname = String::new();
|
|
let mut hostname_file = File::open("/etc/hostname").unwrap();
|
|
hostname_file.read_to_string(&mut hostname).unwrap();
|
|
|
|
let username = format!("\x1B[36;1m{}\x1B[0m@\x1B[36;1m{}\x1B[0m", var("USER").unwrap(), hostname);
|
|
let osname = format!("\x1B[36;1mOS:\x1B[0m {}\n", Os::ArchLinux.name());
|
|
|
|
let info = [
|
|
String::from("\n"),
|
|
username,
|
|
osname,
|
|
];
|
|
|
|
let mut logo_iterator = Os::ArchLinux.ascii_logo().lines();
|
|
let mut info_iterator = info.iter();
|
|
|
|
loop {
|
|
match (logo_iterator.next(), info_iterator.next()) {
|
|
(Some(logo), Some(info)) => print!("{} {}", logo, info),
|
|
(Some(logo), None) => println!("{}", logo),
|
|
_ => break,
|
|
}
|
|
}
|
|
}
|