handle invalid argument
This commit is contained in:
parent
4f74c2f8cd
commit
2841625b15
11
src/lib.rs
11
src/lib.rs
@ -3,6 +3,7 @@ mod color;
|
|||||||
|
|
||||||
use color::Color;
|
use color::Color;
|
||||||
use libc::{c_int, c_void};
|
use libc::{c_int, c_void};
|
||||||
|
use std::process;
|
||||||
|
|
||||||
const VERSION: &str = "2.0.0";
|
const VERSION: &str = "2.0.0";
|
||||||
|
|
||||||
@ -16,12 +17,18 @@ extern "C" {
|
|||||||
pub extern "C" fn rust_main() {
|
pub extern "C" fn rust_main() {
|
||||||
println!("Hello from rust");
|
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);
|
println!("{:?}", args);
|
||||||
|
|
||||||
if args.version {
|
if args.version {
|
||||||
println!("nms version {VERSION}");
|
println!("nms version {VERSION}");
|
||||||
std::process::exit(0);
|
process::exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(color) = args.foreground {
|
if let Some(color) = args.foreground {
|
||||||
|
Loading…
Reference in New Issue
Block a user