args
args copied to clipboard
Add `allowMultiple` param to `addFlag`
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.
requiring negatable
to be false would be a bit nicer if that were the default value ( #26 ).
Can I vote for this feature too