These are chat archives for kbknapp/clap-rs

25th
Jun 2016
Hexjelly
@hexjelly
Jun 25 2016 06:10
Hi, I looked through the documentation but wasn't able to find anything about how to do this, if at all possible. Is there some way to set some common arg settings that would then be used as default through the rest of the app's args? Instead of having to say specify .takes_value(true).use_delimiter(false).required(true) for every single arg, if you want to use it on all of them?
In addition to that, maybe there's some reason why it couldn't be done, but it'd be neat to have some setting or something to make an app sort of infer from Arg::with_name("input") that it would then set .long("input") automatically for you as well
Kevin K.
@kbknapp
Jun 25 2016 13:44
For the second question you can use the from_usage constructor. The name is inferred from the long.
There's no reason your first question couldn't be added, but as of now there's not a way of doing that (short of using a macro)