Skip to content

Fix error message for @Option #435

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

Merged
merged 3 commits into from
Apr 4, 2022
Merged

Fix error message for @Option #435

merged 3 commits into from
Apr 4, 2022

Conversation

KeithBird
Copy link
Contributor

Here's my solution to issue #434. I've written some unit tests and passed all tests, but I still don't know if there are any omissions or is there a way to be more performant. Every thoughts are welcomed.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

@natecook1000
Copy link
Member

@swift-ci Please test

@natecook1000 natecook1000 merged commit dd6efd0 into apple:main Apr 4, 2022
@KeithBird KeithBird deleted the GSoC branch April 4, 2022 05:13
leuski pushed a commit to leuski/swift-argument-parser that referenced this pull request Jun 17, 2022
* 'main' of github.com:apple/swift-argument-parser: (114 commits)
  Fix `AsyncParseableCommand` hierarchy (apple#436)
  Add experimental manual page generation (apple#332)
  Improving edit distance string extension (apple#446)
  List valid options in error messages for enum array argument (apple#445)
  Remove LinuxMain.swift (apple#367)
  Hide hidden subcommands from completions (apple#443)
  Update changelog for 1.1.2 release (apple#441)
  Fix error message for @option array without values (apple#435)
  Fix Repeat's endless printing (apple#437)
  build: statically link ArgumentParserToolInfo always (apple#424)
  Update changelog for the 1.1.1 release (apple#428)
  build: complete the changes from apple#423 (apple#425)
  Remove platform requirement from Package.swift (apple#427)
  build: repair the build after apple#404 (apple#423)
  Fix broken links/incorrect variance calculation (apple#422)
  Update changelog for the 1.1.0 release (apple#421)
  Update documentation (apple#420)
  Make `@OptionGroup(visibility:)` a public API (apple#419)
  Support an `async` entry point for commands (apple#404)
  Fix a typo and template links (apple#418)
  ...
james-fletcher-01 added a commit to james-fletcher-01/swift-argument-parser that referenced this pull request Mar 29, 2025
…alues

Issue apple#434 reported that when a label, but no values, are provided for an array @option property, the error message incorrectly signifies a missing option instead of a missing value. PR apple#435 fixed this for .upToNextOption arrays, but the bug remained for .allRemainingInput arrays.

In addition to tests for verifying the error message, this also adds tests to verify that an attached value counts for the validation. This was a regression for .upToNextOption introduced in apple#435 and fixed in apple#610.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants