Reputation: 29
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?
Upvotes: 0
Views: 862
Reputation: 100170
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.
Upvotes: 2