mirror of
https://github.com/NotAShelf/microfetch.git
synced 2024-11-25 16:36:45 +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
|
@ -17,6 +17,10 @@ use color_eyre::Report;
|
||||||
fn main() -> Result<(), Report> {
|
fn main() -> Result<(), Report> {
|
||||||
color_eyre::install()?;
|
color_eyre::install()?;
|
||||||
|
|
||||||
|
let args: Vec<String> = std::env::args().collect();
|
||||||
|
if args.len() > 1 && args[1] == "--version" {
|
||||||
|
println!("Microfetch {}", env!("CARGO_PKG_VERSION"));
|
||||||
|
} else {
|
||||||
let utsname = nix::sys::utsname::uname()?;
|
let utsname = nix::sys::utsname::uname()?;
|
||||||
let fields = Fields {
|
let fields = Fields {
|
||||||
user_info: get_username_and_hostname(&utsname),
|
user_info: get_username_and_hostname(&utsname),
|
||||||
|
@ -29,8 +33,8 @@ fn main() -> Result<(), Report> {
|
||||||
storage: get_root_disk_usage()?,
|
storage: get_root_disk_usage()?,
|
||||||
colors: print_dots(),
|
colors: print_dots(),
|
||||||
};
|
};
|
||||||
|
|
||||||
print_system_info(&fields);
|
print_system_info(&fields);
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue