Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
natecook1000 opened this issue Aug 28, 2020 · 0 comments · Fixed by #232
Closed
2 tasks done

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

natecook1000 opened this issue Aug 28, 2020 · 0 comments · Fixed by #232
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@natecook1000
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant