feat: add help menu and -v argument to show version (#24)

* add a way to print version

* implement help menu
This commit is contained in:
OldWorldOrdr 2023-04-14 06:55:59 -04:00 committed by GitHub
parent 0ab0e5243f
commit 6ab6bbe8ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -202,6 +202,16 @@ fn get_info(
}
fn main() {
// parse arguements
if std::env::args().any(|arg| arg.starts_with("-v") || arg.starts_with("--v")) {
println!("pfetch-rs {}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
} else if std::env::args().len() > 1 {
println!("pfetch show system information");
println!("pfetch -v show version");
std::process::exit(0);
}
// source file specified by env: PF_SOURCE
if let Ok(filepath) = dotenvy::var("PF_SOURCE") {
dotenvy::from_path(filepath).unwrap();