I thought I'd like more eyes on this.
https://github.com/nim-lang/Nim/pull/25499
Current std/parseopt is nice, but it's idiosyncratic and requires getting used to. Some things are hard or impossible with it, though.
Instead of writing another replacement, that will be criticized to oblivion, I just added two other parser modes and a way to configure a custom parser behaviour, all totally transparent, hidden under compile-time switches. So nothing should break and if you need that sense of comfort and familiarity in the CLI parser of your program behaves, now it might be possible!
Hope the discussion doesn't devolve to arguing about personal preferences and standard compliance, though in the case of the new Gnu mode, I'd like to get it to be as close to people's expectations as possible.
So, if you think that:
you might find this PR to your liking. But if you don't, still you might.
-c val as k:c, v:val
+1
In my opinion, the current course of action is very unfortunate; even when shortNoVal is defined, parseopt, in my experience, does not behave as intended. At least, it doesn't behave as I would like. There have already been extensive discussions about the implementation with regard to POSIX, with arguments for and against. Perhaps the various alternative suggestions and discussions also indicate that parseopt does not behave as expected for many users.
The proposed interpretation would, in my opinion, represent a significant improvement without requiring external sources.
I assume --config file would work as well: k: config, v: file
This should work already and will work with every of the three modes, as long as longNoVal is not empty and config is not in it. See lines 266:269 in the test file.
Thank you for the feedback!