Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: When a Grammar combines flags with passthrough args, see if an u…
…nrecognized flag may be treated as a positional argument ### Issue Given a grammar like this: ```golang var cli struct { Args []string `arg:"" optional:"" passthrough:""` } ``` The first positional argument implies that it was preceded by `--`, so subsequent flags are not parsed. If Kong parses `cli 1 --unknown 3`, it will populate `Args` with `[]string{"1", "--unknown", "3"}`. However, if Kong parses `cli --unknown 2 3`, it will fail saying that `--unknown` is an unrecognized flag. ### Proposal This commit changes the parser so that if an unknown flag _could_ be treated as the first passthrough argument, it is. After this change, if Kong parses `cli --unknown 2 3`, it will populate `Args` with `[]string{"--unknown", "2", "3"}`.
- Loading branch information