handle invalid argument

This commit is contained in:
Greg Shuflin 2023-07-23 20:05:26 -07:00
parent 4f74c2f8cd
commit 2841625b15
1 changed files with 9 additions and 2 deletions

View File

@ -3,6 +3,7 @@ mod color;
use color::Color;
use libc::{c_int, c_void};
use std::process;
const VERSION: &str = "2.0.0";
@ -16,12 +17,18 @@ extern "C" {
pub extern "C" fn rust_main() {
println!("Hello from rust");
let args = args::parse_arguments().unwrap();
let args = match args::parse_arguments() {
Ok(args) => args,
Err(e) => {
println!("{e}");
process::exit(1);
}
};
println!("{:?}", args);
if args.version {
println!("nms version {VERSION}");
std::process::exit(0);
process::exit(0);
}
if let Some(color) = args.foreground {