forked from clap-rs/clap
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(clap-rs#1374): Remove all values from previous occurrences on sel…
…f-override When an argument gets self-overriden, at most a single value[1] gets removed from the existing values list. This is incorrect when the argument has multiple values per occurrence, and makes for "funny" bugs such as `--input --input a b` being parsed as `--input b` and `--input a b c --input d` being parsed as `--input c d`. This patch fixes the issue by keeping track of how many values were already present when we started parsing each occurrence, and removing all the values but the ones for the last occurrence when a self-override occurs. [1]: Actually at most two values due to clap handling the overrides twice, which is a separate bug fixed in v3.
- Loading branch information
Showing
3 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters