args icon indicating copy to clipboard operation
args copied to clipboard

Add `allowMultiple` param to `addFlag`

Open seaneagan opened this issue 9 years ago • 2 comments

Currently only addOption has the allowMultiple param, but it can be useful to allow multiple flags as well. For example to specify a verbosity level many scripts use multiple verbose flags:

foo -vvv

The main use case is to count flag occurrences. For this, we could require negatable to be false when allowMultiple is true, and then have ArgResults['multi-flag'] return an int representing how many times the flag was passed.

Alternatively we could allow negatable to be true, and have ArgResults['multi-flag'] return a List<bool>, but I'm not sure what the use case for that would be.

seaneagan avatar Jun 09 '15 15:06 seaneagan

requiring negatable to be false would be a bit nicer if that were the default value ( #26 ).

seaneagan avatar Jun 09 '15 15:06 seaneagan

Can I vote for this feature too

berkobob avatar Jun 13 '22 11:06 berkobob