mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-24 22:34:42 +01:00
Show usage for code_gen
This commit is contained in:
@@ -53,7 +53,7 @@ impl FromStr for RadiusAttributeValueType {
|
||||
}
|
||||
|
||||
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));
|
||||
process::exit(0);
|
||||
}
|
||||
@@ -68,13 +68,18 @@ where
|
||||
|
||||
fn main() {
|
||||
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
|
||||
.parse(&args[1..])
|
||||
.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]);
|
||||
if !dict_file_path.exists() {
|
||||
panic!("no such dictionary file => {}", &matches.free[0]);
|
||||
|
||||
Reference in New Issue
Block a user