These are chat archives for kbknapp/clap-rs

Jul 2017
Denis Lisov
Jul 20 2017 10:53
I'm writing an utility with some subcommands used like util summarize *.bin. All the subcommands I need take a list of files as positional arguments. Is it possible to define the file_list argument once (not repeating it per subcommand) in such a way that I can still use util summarize *.bin and not util *.bin summarize?
Kevin K.
Jul 20 2017 13:29
@tanriol you'd have to define file_list using a let binding, the pass .arg(&file_list) to each subcommand
Using global args would do what you want but unfortunately allow util *.bin summarize too
@boxdot th
That is a bug actually, the work around is to use Arg::from_usage().empty_values(false)
I've been putting all my efforts into 3.x so I apologise for missing these questions