Skip to content

Conversation

@glessard
Copy link
Contributor

@glessard glessard commented Mar 6, 2020

Previously, using a set of flags declared with FlagExclusivity.chooseFirst would result in an error instead of choosing the first from the command line. (See #66).

Detailed Design

Added a case handling repeating arguments in the ArgumentSet.updateFlag function.
The previous behaviour had the repeating-arguments-with-.chooseFirst situation going through the default case, which didn't add the current argument to the list of used arguments, which later caused an error due to the argument being incorrectly deemed to have not been used.

Documentation Plan

No change to documentation is needed.

Test Plan

Tests added to FlagsEndToEndTests.testParsing_invert and FlagsEndToEndTests.testParsingCaseIterable_RepeatableFlags.

Source Impact

None.

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

This PR fixes #66

Copy link
Member

@natecook1000 natecook1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @glessard! 🎉

@natecook1000 natecook1000 merged commit 7f5984a into apple:master Mar 6, 2020
@glessard glessard deleted the choose-first branch March 6, 2020 22:42
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.

Repeated flags with FlagExclusivity.chooseFirst error instead of choosing first.

2 participants