Problem
System.CommandLine tokenizes --batch=a into an option identifier and an argument, so repeated equals syntax is counted correctly.
However, this command:
run "trim" --batch --batch
can treat the second --batch token as the first option's value. A raw token count therefore counts both occurrences and incorrectly reports a duplicate option.
Expected behavior
Duplicate detection should use the parsed option result rather than raw tokens.
Use:
result.GetResult(batch)?.IdentifierTokenCount ?? 0
so only actual option identifiers are counted.
Acceptance criteria
--batch=a --batch=b is still detected as a duplicate when duplicates are not allowed.
--batch --batch does not produce a false duplicate solely because the second token was parsed as the first option's value.
- Add regression tests covering both equals syntax and repeated bare option tokens.
Problem
System.CommandLinetokenizes--batch=ainto an option identifier and an argument, so repeated equals syntax is counted correctly.However, this command:
can treat the second
--batchtoken as the first option's value. A raw token count therefore counts both occurrences and incorrectly reports a duplicate option.Expected behavior
Duplicate detection should use the parsed option result rather than raw tokens.
Use:
so only actual option identifiers are counted.
Acceptance criteria
--batch=a --batch=bis still detected as a duplicate when duplicates are not allowed.--batch --batchdoes not produce a false duplicate solely because the second token was parsed as the first option's value.