Skip to content

Single- and double-dashed options with the same name should be allowed #231

@natecook1000

Description

@natecook1000

Options with the same name, but different number of dashes, are currently prohibited by the name validator.

ArgumentParser version: 0.3.0
Swift version: Swift version 5.3 (swiftlang-1200.0.28.1 clang-1200.0.30.1)

Checklist

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

Steps to Reproduce

For example, changing the Repeat example's count property to this:

    @Option(name: [.long, .customLong("count", withSingleDash: true)],
            help: "The number of times to repeat 'phrase'.")
    var count: Int?

results in:

Fatal error: Validation failed for `Repeat`:

- Multiple (2) `Option` or `Flag` arguments are named "count".

Expected behavior

Either -count or --count should work for that option.

Actual behavior

The error shown above.

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