-
Notifications
You must be signed in to change notification settings - Fork 352
Use the first long name in usage #179
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
Conversation
Sorting names for option has been changed. * Usage will choose the first long name, if available, or otherwise the first short name * Help screen will show short names, then long names, in the order of their declaration. Solves (#167)
natecook1000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for this improvement, @ibrahimoktay! It looks like we need to make sure this is working in a couple edge cases — notes below.
Sources/ArgumentParser/Parsable Properties/NameSpecification.swift
Outdated
Show resolved
Hide resolved
Checkin long names in sort caused single dash long names to be treated as a short name. Fixed sort to check “short” instead of “long” Update current test to cover more cases.
Sources/ArgumentParser/Parsable Properties/NameSpecification.swift
Outdated
Show resolved
Hide resolved
Sources/ArgumentParser/Parsable Properties/NameSpecification.swift
Outdated
Show resolved
Hide resolved
*Replace sortedNames with partitionedNames *Extract uniquifying logic into SequenceExtensions.swift
natecook1000
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, @ibrahimoktay! Just one note below.
| } | ||
|
|
||
| var isShort: Bool { | ||
| return self == .short(self.valueString.first!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last nit — this should use pattern-matching on self instead of an equality comparison. We don't need to be accessing valueString for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right. Just changed that.
|
@swift-ci Please test |
Add missing reference to `Utilities/SequenceExtensions.swift` which was failed to be updated with apple#179
Add missing reference to `Utilities/SequenceExtensions.swift` which was failed to be updated with #179
SortedNames for ArgumentDefinition has been changed.
NameSpecification now uses Array type for elements.
Solves (#167)
Replace this paragraph with a description of your changes and rationale. Provide links to an existing issue or external references/discussions, if appropriate.
Checklist