oh shit this might actually be quite usable

This commit is contained in:
nora 2021-09-24 22:17:30 +02:00
parent c126dda2df
commit cdb67f070c
5 changed files with 221 additions and 48 deletions

View file

@ -1,24 +1,14 @@
use badargs::{CliArg, CliArgInfo, Template};
use std::collections::HashMap;
use badargs::arg;
use badargs::CliArg;
#[derive(Default)]
struct OutFile;
arg!(OutFile: "output", "o" -> Option<String>);
arg!(Force: "force", "f" -> bool);
arg!(OLevel: "optimize" -> usize);
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 args = badargs::badargs::<(OutFile, (Force, OLevel))>().unwrap();
let outfile = args.get::<OutFile>();
let _outfile = args.get::<OutFile>();
let _force = args.get::<Force>();
let _o_level = args.get::<OLevel>();
}