use structopt::StructOpt;
fn main() {
println!("Hello, world!");
// let k = Cli::from_args();
let arg = [""]; // what should be arg here
let k = Cli::from_iter(&arg);
println!("{:?}", k);
}
#[derive(Debug, StructOpt)]
struct Cli {
#[structopt(short, long)]
a: i32,
#[structopt(short, long)]
b: i32,
}
I have a requirement in which instead of using actual command line arguments I need to use a string from which I need to get the respective struct value.For this I can use from_iter()
but I'm not able to figure out what should be the argument for it. also I can't find an example code for from_iter()
in documentation as well. please help