with_args/
with_args.rs

1use std::env::args;
2
3use clier::hooks::{use_double_dash, use_flag};
4use clier::Clier;
5
6fn main() {
7  let raw_args = args().collect::<Vec<String>>();
8  let raw_args = &raw_args[1..];
9  let args = Clier::with_args(raw_args);
10
11  // Try changing 'String' to 'bool', or 'i64'
12  let example_hook: Result<String, clier::hooks::FlagError> =
13    use_flag("testing", Some('t'), &args).try_into();
14
15  // Everything to the right of '--'
16  let raw = use_double_dash(&args);
17
18  println!("flag testing: {:#?}\neverything after '--': {:?}", example_hook, raw);
19}