bunbun/src/main.rs

35 lines
977 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:22:46 +00:00
println!("{:>32}", combined.italic());
println!("{:>17} {}", "Arch".cyan().bold(), arch);
println!("{:>8} {:>6} {}", ascii[0], "OS".blue().bold(), pretty);
println!("{:>9} {:>9} {}", ascii[1], "Kernel".red().bold(), kernel);
println!("{:>28} {:>4} {}", ascii[2], "WM".green().bold(), wm);
2024-03-23 21:58:32 +00:00
}