template things

This commit is contained in:
nora 2021-09-20 15:34:14 +02:00
parent 26d52a306f
commit 2535e6c046
2 changed files with 65 additions and 5 deletions

24
examples/compiler.rs Normal file
View file

@ -0,0 +1,24 @@
use badargs::{CliArg, CliArgInfo, Template};
use std::collections::HashMap;
#[derive(Default)]
struct OutFile;
fn main() {
let args = badargs::badargs(Template {
options: {
let mut map = HashMap::new();
map.insert(
Box::new(OutFile),
CliArgInfo {
name: "output".to_string(),
allow_short: true,
takes_value: true,
},
);
map
},
});
let outfile = args.get::<OutFile>();
}