[version-name] Try stripping .0 patch version to find a matching Xcode #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The purpose of this PR is to add handling to xcenv-version-name to account for versions specified as X.X.0. Even though Xcode's CFBundleShortVersionString tends to drop the trailing patch number in the version specifier, it's conceivable that someone might want to include the patch version in their command for the sake of consistency (i.e.: 11.6.0, 11.6.1 etc).
This functionality has been written such that it doesn't assume that Apple will continue the pattern of dropping the patch version in Xcode's CFBundleShortVersionString, however, this means that in all cases of a failed version match, the find_xcode_app_from_version function will be run twice. Instead, if we accept the aforementioned assumption, we can simply check whether the version passed into the command meets the X.X.0 format and simply drop the patch version immediately. Happy to take feedback on this!