kong icon indicating copy to clipboard operation
kong copied to clipboard

Return an error if flag is provided twice

Open mitar opened this issue 1 year ago • 2 comments
trafficstars

I had an issue that I made a mistake and instead of:

program -o /path --out .ext

I wrote:

program -o /path -out .ext

And was confused why is program writing out to "ut.ext" directory instead to /path. Is there a way to request kong to fail CLI parsing if a flag is provided twice? So for use cases like -vvv with counters this might be reasonable. And when field type is a slice. But providing multiple flags when field type is not a slice should return an error and not just that later flag silently overrides a prior flag. Or at least there should be an option to control this. What do you think?

mitar avatar Aug 02 '24 23:08 mitar

Seems like reasonable opt-in behaviour, but it can't be the default because it would be backwards incompatible.

alecthomas avatar Aug 03 '24 03:08 alecthomas

Of course.

mitar avatar Aug 03 '24 04:08 mitar