These are chat archives for kbknapp/clap-rs

6th
Feb 2019
Denis Lisov
@tanriol
Feb 06 07:34
You probably want to build a test App and parse some test command-line, no?
Eric Normandeau
@enormandeau
Feb 06 15:50
Hi. This has probably been asked but is it possible to have arguments automatically cast to specific types? Right now I manually do .unwrap().parse::<T>().expect("asdf")
Denis Lisov
@tanriol
Feb 06 15:51
Have you tried structopt?
Eric Normandeau
@enormandeau
Feb 06 15:52
I guess I'd like to be able to add .type(i32) to the .args(...) command and let it test if user input is not valid.
So then this is not possible in clap directly?
I quite like how clap works, I'd just have wanted auto-types for options :)
Denis Lisov
@tanriol
Feb 06 15:58
Well, there's value_t_or_exit!, but it's not very comfortable...
IIUC, there will be support for that in 3.0, as well as something structopt-like for collecting the arguments into a struct automatically.
Eric Normandeau
@enormandeau
Feb 06 16:00
By pure curiosity, any ETA on 3.0?
Denis Lisov
@tanriol
Feb 06 16:01
No idea.
Eric Normandeau
@enormandeau
Feb 06 16:02
OK, thanks. I'll stick with my manual approach for now and keep an eye on future development.
Jearvon Dharrie
@iamjarvo
Feb 06 22:29
@tanriol Thats what I ended up doing after discovering get_matches_from thank you