XOR CommandLine arguments

With the CommandLine library, is there a way to specify that one of two options must be present?

I have two parameters, -if and -od. I want an error if neither is present or if both are present.

Could you do something like -mode={if,od} and make the option required?

– Sean Silva

Both arguments require a string. Sorry, I forgot to mention that.

Maybe something like -mode={if,od} together with -mode-arg=<string> ? (that probably won’t work if the -mode-arg means wildly different things for the two options)

– Sean Silva

by “won’t work” I mean it may be pretty unintuitive.

Not the prettiest, but cleaner than what I was thinking.