bunbun/src/main.rs

35 lines
959 B
Rust
Raw Normal View History

2024-03-23 21:58:32 +00:00
use colored::Colorize;
2024-03-23 22:35:06 +00:00
use sysinfo::System;
use whoami::*;
use std::env;
2024-03-23 21:58:32 +00:00
fn main() {
let bottom = format!("c({})({})", "\"".red(), "\"".red()).to_string();
let ascii = vec!["(\\ /)", "( . .)", &bottom];
2024-03-23 23:17:07 +00:00
let hostname = fallible::hostname().unwrap_or(String::from("N/A"));
let user = env!("USER");
let arch = arch();
let combined = format!("{}@{}", user, hostname);
2024-03-23 22:35:06 +00:00
let kernel = System::kernel_version().unwrap_or(String::from("N/A"));
let pretty = distro();
let wm: &str;
if cfg!(windows) {
wm = "Aero";
} else if cfg!(unix) {
wm = env!("XDG_CURRENT_DESKTOP");
} else {
wm = "N/A";
2024-03-23 21:58:32 +00:00
}
2024-03-23 22:35:06 +00:00
2024-03-23 23:17:07 +00:00
println!("{:>34}", combined.magenta().bold());
println!("{:>19} {}", "Arch".cyan(), arch);
println!("{:>9} {:>11} {}", ascii[0], "Kernel".red(), kernel);
println!("{:>10} {:>6} {}", ascii[1], "WM".green(), wm);
println!("{:>29} {:>5} {}", ascii[2], "OS".blue(), pretty);
2024-03-23 21:58:32 +00:00
}