I would like to be able to pass arguments using only the - and the + characters in the following format to clap or other arg lib.
program -i infile.txt -o outfile.txt - stra strb strc - strd stre strf + strg + strh stri
Where in the program I could then obtain vectors with the following groupings...
[stra, strb, strc]
[strd, stre, strf]
[strg]
[strh, stri]
Is this possible in Clap or another rust arg library? If so how can I accomplish it?
That is an unusual notation, and I wouldn't expect any library to have an option for it.
Usually --
stops parsing arguments, so you can have your -
after this delimiter:
program -i infile -- special - separator - args
Otherwise you'll need to get std::env::args().collect::<Vec<_>>()
yourself, and split out or preprocess these args before passing them to Clap.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.