Open matejak opened 7 years ago
Would these replace the existing ARG_OPTIONAL_REPEATED
and ARG_OPTIONAL_INCREMENTAL
macros, or would they be an alias for the _ADD
implementations?
I might use ARG_OPTIONAL_REPEATED_SUPPLEMENT
instead. I can't put my finger on the exact reasoning, but as a native English speaker I think "supplement" is clearer.
The only thing this doesn't address from #12 is the idea that it might be possible that the user would want to override this, rather than just the tool developer. For example, the tool developer might use the _ADD
implementation because they feel that certain values must always be present, but the user might disagree. I'm not sure that this is a use-case worth designing for, but it's never a bad idea to consider all the possibilities.
Good point about the user overrides. I will think a bit more and come up with something.
I'm definitely :+1: for ARG_OPTIONAL_REPEATED to have alternative handling. I'd like to be able to replace the options rather than appending.
This would be useful to me - I'm writing a script to generate specimen text, and would like to specify a default list of characters to process, but the user should be able to override the character list with their own, rather than adding to the default. I'd be using ARG_OPTIONAL_REPEATED_REPLACE to get multiple lines of characters.
The
ARG_OPTIONAL_REPEATED
andARG_OPTIONAL_INCREMENTAL
currently extend their defaults. It may make sense to give a possibility to pick the way defaults are handled, because there are legitimate use cases when users want the defaults to be forgotten if they supply value(s) to these commands (see #12 for more in-depth insights). The proposal is to introduce two alternatives for each macro that is in question:ARG_OPTIONAL_REPEATED_ADD
ARG_OPTIONAL_REPEATED_REPLACE
ARG_OPTIONAL_INCREMENTAL_ADD
ARG_OPTIONAL_INCREMENTAL_REPLACE
Those macros would accept the same arguments, but they would treat the defaults differently (and also the help message would have to be different). Any feedback is welcome, but most importantly: