mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-30 17:08:45 +01:00
Show usage for code_gen
This commit is contained in:
+8
-3
@@ -53,7 +53,7 @@ impl FromStr for RadiusAttributeValueType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn print_usage(program: &str, opts: &Options) {
|
fn print_usage(program: &str, opts: &Options) {
|
||||||
let brief = format!("Usage: {} FILE [options]", program);
|
let brief = format!("Usage: {} [options] DICT_FILE OUT_FILE", program);
|
||||||
print!("{}", opts.usage(&brief));
|
print!("{}", opts.usage(&brief));
|
||||||
process::exit(0);
|
process::exit(0);
|
||||||
}
|
}
|
||||||
@@ -68,13 +68,18 @@ where
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let args: Vec<String> = env::args().collect();
|
let args: Vec<String> = env::args().collect();
|
||||||
let _program = args[0].clone();
|
let program = args[0].clone();
|
||||||
|
|
||||||
let opts = Options::new();
|
let mut opts = Options::new();
|
||||||
|
opts.optflag("h", "help", "print this help menu");
|
||||||
let matches = opts
|
let matches = opts
|
||||||
.parse(&args[1..])
|
.parse(&args[1..])
|
||||||
.unwrap_or_else(|f| panic!(f.to_string()));
|
.unwrap_or_else(|f| panic!(f.to_string()));
|
||||||
|
|
||||||
|
if matches.opt_present("h") {
|
||||||
|
print_usage(&program, &opts);
|
||||||
|
}
|
||||||
|
|
||||||
let dict_file_path = Path::new(&matches.free[0]);
|
let dict_file_path = Path::new(&matches.free[0]);
|
||||||
if !dict_file_path.exists() {
|
if !dict_file_path.exists() {
|
||||||
panic!("no such dictionary file => {}", &matches.free[0]);
|
panic!("no such dictionary file => {}", &matches.free[0]);
|
||||||
|
|||||||
Reference in New Issue
Block a user