apple / apple/swift-argument-parser
Wrong error when providing an argument to an unknown option
- Dominant language
- Swift
- Stars
- 3.8k
- Forks
- 411
- Avg merge
- 7d 13h
- Merged PRs (30d)
- 17
Description
Given this argument parser:
```
fileprivate struct Qwz: ParsableArguments {
@Option() var name: String?
}
```
When I call it with `--nm Name`, I expect `Unknown option '--nm'`, but I get `Unexpected argument 'Name'`.
Failing test case:
```
extension ErrorMessageTests {
func testMispelledArgument_1() {
AssertErrorMessage(Qwz.self, ["--nme", "Me"], "Unknown option '--nme'.")
}
}
```
Contributor guide
Research direction
Start with the ErrorMessageTests test case shown in the issue and run the parser with ["--nme", "Me"] against Qwz. Trace how the unknown option and its following value are classified. Done means the test reports "Unknown option '--nme'." rather than "Unexpected argument 'Me'."
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100