Is it possible to supply multiple values to a single switch instance. Ie, instead of requiring
-L /a/b -L /a/c -L /a/d
-L /a/b /a/c /a/d
parsing the values would stop at the next switch or end of input.
Yup, this is something that has been (privately) discussed in the past. We'll try and get it into the next release.
The problem with this is that if a MultiArg is followed by an Unlabeled arg, then there is no way to know when one ends and the other begins.
One possibility is to provide an option that allows multiple values for one flag and disallows Unlabeled args.
No promises on getting this into the next release.
Are there any updates for this feature?
It's really important one for me.
Sorry, this feature has not been "officially" added and I don't foresee doing so any time soon. That said, there is some code, currently commented out, in MultiArg.h (lines 436-442) that looks like it accomplishes what you want. You might consider uncommenting that code and giving it a try. Of course, this code obviously hasn't been tested and I can't promise that it won't cause things to explode. I guarantee that it will cause problems if you're using unlabeled args.
Let me know if you have any success with this. Good luck!
You said "the problem with this is that if a MultiArg is followed by an Unlabeled arg, then there is no way to know when one ends and the other begins" but I think there might be a way. If parsing of a MultiArg ends at end of line or when the next "-" is found then the unlabelled (sic) args are ones left over after such parsing ends. The ancient Prime Computers (remember those?) used to do command line handling in this way (using their cl$pix routine for anyone old enough to be interested in such things). This did require at least two parsings of the command line (all done internally within cl$pix). What TCLAP calls Unlabeled, Prime would call "unclaimed". This wouldn't exactly be trivial, I admit.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.