Skip to content

Incorrect error message for @Option array without values #434

@natecook1000

Description

@natecook1000

The error message when giving an option label, but no values, is incorrect for @Option array properties. For example, with this command:

@main
struct Example: ParsableCommand {
  @Option(parsing: .upToNextOption)
  var test: [String] = []

  mutating func run() throws {
    print(test)
  }
}

Expected behavior

$ example --test
Error: Missing value for '--test <test>'

Actual behavior

$ example --test
Error: Unknown option '--test'. Did you mean '--test'?

Checklist

  • If possible, I've reproduced the issue using the main branch of this package
  • I've searched for existing GitHub issues

ArgumentParser version: main
Swift version: swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions