2026-01-05 17:57:53 -05:00
|
|
|
// neoarz
|
|
|
|
|
// neo64fetch - "jarvis, rewrite this project in rust"
|
|
|
|
|
|
|
|
|
|
use std::env;
|
|
|
|
|
use sysinfo::System;
|
2026-01-07 15:20:48 -05:00
|
|
|
|
2026-01-05 17:57:53 -05:00
|
|
|
mod helpers;
|
2026-01-07 15:20:48 -05:00
|
|
|
mod output;
|
|
|
|
|
|
|
|
|
|
use output::colors;
|
2026-01-05 17:57:53 -05:00
|
|
|
|
|
|
|
|
struct Stats {
|
|
|
|
|
// Neoarz[at]Mac
|
|
|
|
|
username: String,
|
|
|
|
|
hostname: String,
|
|
|
|
|
// --------------
|
|
|
|
|
os: String,
|
|
|
|
|
host: String,
|
|
|
|
|
kernel: String,
|
|
|
|
|
uptime: String,
|
|
|
|
|
packages: String,
|
|
|
|
|
shell: String,
|
|
|
|
|
display: String,
|
2026-01-05 20:42:12 -05:00
|
|
|
desktop_env: String,
|
|
|
|
|
window_manager: String,
|
|
|
|
|
window_manager_theme: String,
|
|
|
|
|
font: String,
|
|
|
|
|
cursor: String,
|
|
|
|
|
terminal: String,
|
|
|
|
|
terminal_font: String,
|
2026-01-06 20:58:05 -05:00
|
|
|
cpu: String,
|
|
|
|
|
gpu: String,
|
|
|
|
|
memory: String,
|
|
|
|
|
swap: String,
|
|
|
|
|
storage: String,
|
|
|
|
|
ip: String,
|
|
|
|
|
battery: String,
|
|
|
|
|
locale: String,
|
2026-01-05 17:57:53 -05:00
|
|
|
|
2026-01-05 20:42:12 -05:00
|
|
|
// Extra fields
|
2026-01-05 17:57:53 -05:00
|
|
|
architecture: String,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let mut sys = System::new_all();
|
|
|
|
|
sys.refresh_all();
|
|
|
|
|
|
|
|
|
|
let stats = Stats {
|
|
|
|
|
hostname: System::host_name().unwrap_or_else(|| "<unknown>".to_owned()),
|
2026-01-07 16:19:04 -05:00
|
|
|
// This would be the real username of the system but I just want to print out Neoarz for my case
|
|
|
|
|
// Uncoment the line below to use the real username
|
|
|
|
|
/*
|
2026-01-05 17:57:53 -05:00
|
|
|
username: env::var("USER")
|
|
|
|
|
.or_else(|_| env::var("USERNAME"))
|
|
|
|
|
.unwrap_or_else(|_| "<unknown>".to_owned()),
|
2026-01-07 16:19:04 -05:00
|
|
|
*/
|
|
|
|
|
username: "Neoarz".to_owned(),
|
2026-01-05 17:57:53 -05:00
|
|
|
os: System::long_os_version().unwrap_or_else(|| "<unknown>".to_owned()),
|
2026-01-07 16:19:04 -05:00
|
|
|
host: helpers::host::get_host_info(),
|
2026-01-05 17:57:53 -05:00
|
|
|
architecture: System::cpu_arch(),
|
|
|
|
|
kernel: System::kernel_long_version(),
|
|
|
|
|
uptime: helpers::uptime::get_uptime(System::uptime()),
|
|
|
|
|
packages: helpers::packages::get_brew_info(),
|
|
|
|
|
shell: helpers::shell::get_shell_info(),
|
|
|
|
|
display: helpers::display::get_display_info(),
|
2026-01-05 20:42:12 -05:00
|
|
|
desktop_env: helpers::desktop_env::get_desktop_env_info(),
|
|
|
|
|
window_manager: helpers::wm::get_window_manager_info().wm_pretty_name,
|
|
|
|
|
window_manager_theme: helpers::wm_theme::get_wm_theme_info(),
|
|
|
|
|
font: helpers::font::get_font_info(),
|
|
|
|
|
cursor: helpers::cursor::get_cursor_info(),
|
|
|
|
|
terminal: helpers::terminal::get_terminal_info(),
|
|
|
|
|
terminal_font: helpers::terminal_font::get_terminal_font_info(),
|
2026-01-06 20:58:05 -05:00
|
|
|
cpu: helpers::cpu::get_cpu_info(),
|
|
|
|
|
gpu: helpers::gpu::get_gpu_info(),
|
|
|
|
|
memory: helpers::memory::get_memory_info(),
|
|
|
|
|
swap: helpers::swap::get_swap_info(),
|
|
|
|
|
storage: helpers::storage::get_storage_info(),
|
|
|
|
|
ip: helpers::ip::get_ip_info(),
|
|
|
|
|
battery: helpers::battery::get_battery_info(),
|
|
|
|
|
locale: helpers::locale::get_locale_info(),
|
2026-01-05 17:57:53 -05:00
|
|
|
};
|
|
|
|
|
|
2026-01-07 15:20:48 -05:00
|
|
|
// user@host
|
|
|
|
|
println!("{}", colors::title(&stats.username, &stats.hostname));
|
|
|
|
|
|
|
|
|
|
// separator
|
|
|
|
|
println!("{}", colors::separator(stats.username.len() + stats.hostname.len() + 1));
|
|
|
|
|
|
|
|
|
|
// info
|
|
|
|
|
println!("{}", colors::info("OS", &format!("{} {}", stats.os, stats.architecture)));
|
|
|
|
|
println!("{}", colors::info("Host", &stats.host));
|
|
|
|
|
println!("{}", colors::info("Kernel", &stats.kernel));
|
|
|
|
|
println!("{}", colors::info("Uptime", &stats.uptime));
|
|
|
|
|
println!("{}", colors::info("Packages", &stats.packages));
|
|
|
|
|
println!("{}", colors::info("Shell", &stats.shell));
|
|
|
|
|
println!("{}", colors::info("Display", &stats.display));
|
|
|
|
|
println!("{}", colors::info("DE", &stats.desktop_env));
|
|
|
|
|
println!("{}", colors::info("WM", &stats.window_manager));
|
|
|
|
|
println!("{}", colors::info("WM Theme", &stats.window_manager_theme));
|
|
|
|
|
println!("{}", colors::info("Font", &stats.font));
|
|
|
|
|
println!("{}", colors::info("Cursor", &stats.cursor));
|
|
|
|
|
println!("{}", colors::info("Terminal", &stats.terminal));
|
|
|
|
|
println!("{}", colors::info("Terminal Font", &stats.terminal_font));
|
|
|
|
|
println!("{}", colors::info("CPU", &stats.cpu));
|
|
|
|
|
println!("{}", colors::info("GPU", &stats.gpu));
|
|
|
|
|
println!("{}", colors::info("Memory", &stats.memory));
|
|
|
|
|
println!("{}", colors::info("Swap", &stats.swap));
|
|
|
|
|
println!("{}", colors::info("Disk (/)", &stats.storage));
|
2026-01-07 16:19:04 -05:00
|
|
|
// Don't wanna show print this lolol
|
|
|
|
|
// println!("{}", colors::info("Local IP", &stats.ip));
|
2026-01-07 15:20:48 -05:00
|
|
|
println!("{}", colors::info("Battery", &stats.battery));
|
|
|
|
|
println!("{}", colors::info("Locale", &stats.locale));
|
|
|
|
|
|
|
|
|
|
// color blocks
|
|
|
|
|
println!();
|
|
|
|
|
println!("{}", colors::color_blocks());
|
2026-01-05 17:57:53 -05:00
|
|
|
}
|