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:
parent
0ab0e5243f
commit
6ab6bbe8ac
10
src/main.rs
10
src/main.rs
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user