mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-01 06:41:15 +00:00
implement --version for checking program version (#10)
Some checks failed
Rust / build (push) Has been cancelled
Some checks failed
Rust / build (push) Has been cancelled
This commit is contained in:
parent
9ed9e8d930
commit
8f5bfcbd05
1 changed files with 18 additions and 14 deletions
32
src/main.rs
32
src/main.rs
|
@ -17,20 +17,24 @@ use color_eyre::Report;
|
||||||
fn main() -> Result<(), Report> {
|
fn main() -> Result<(), Report> {
|
||||||
color_eyre::install()?;
|
color_eyre::install()?;
|
||||||
|
|
||||||
let utsname = nix::sys::utsname::uname()?;
|
let args: Vec<String> = std::env::args().collect();
|
||||||
let fields = Fields {
|
if args.len() > 1 && args[1] == "--version" {
|
||||||
user_info: get_username_and_hostname(&utsname),
|
println!("Microfetch {}", env!("CARGO_PKG_VERSION"));
|
||||||
os_name: get_os_pretty_name()?,
|
} else {
|
||||||
kernel_version: get_system_info(&utsname)?,
|
let utsname = nix::sys::utsname::uname()?;
|
||||||
shell: get_shell(),
|
let fields = Fields {
|
||||||
desktop: get_desktop_info(),
|
user_info: get_username_and_hostname(&utsname),
|
||||||
uptime: get_current()?,
|
os_name: get_os_pretty_name()?,
|
||||||
memory_usage: get_memory_usage()?,
|
kernel_version: get_system_info(&utsname)?,
|
||||||
storage: get_root_disk_usage()?,
|
shell: get_shell(),
|
||||||
colors: print_dots(),
|
desktop: get_desktop_info(),
|
||||||
};
|
uptime: get_current()?,
|
||||||
|
memory_usage: get_memory_usage()?,
|
||||||
print_system_info(&fields);
|
storage: get_root_disk_usage()?,
|
||||||
|
colors: print_dots(),
|
||||||
|
};
|
||||||
|
print_system_info(&fields);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue