args
args copied to clipboard
Support overriding the default negated name of a boolean flag.
It would be great to be able to use the args package in contexts where the naming convetion for negated flags are different which requires overriding the default negated flag name (--no-
This could e.g. be done by adding an optional negatedName parameter to the addFlag method.
Could you give an example? Is it still a prefix, or does it replace the whole name?
I was thinking it should just replace the entire negated name.
Something like
parser.addFlag('fast', negatedName: 'slow')
which results in the --slow flags being the opposite of the --fast which in some cases are better than the default --no-fast. This would also allow changing the prefix, by e.g.
parser.addFlag('foo', negatedName: 'nofoo');
giving --nofoo instead of --no-foo.
I just took a look at the code and the way it is structured today seems like it would be much simpler to support a new prefix that overriding the full name.
Solving the second use case above by supporting a new negated prefix would be great too. Completely overriding negated flag names could come as an additional improvement later.