Skip to content
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

Allow somewhat fuzzy version matching for install and uninstall commands #117

Merged

Conversation

interstateone
Copy link
Contributor

@interstateone interstateone commented Nov 14, 2020

This PR extracts the behaviour added in #115, which allows users to omit prerelease identifiers (like "beta 2") in command arguments when it's unambiguous, and uses it in the install and uninstall commands. If the version is ambiguous then it should fail.

Testing

First, clone this repo if necessary and check out the PR branch:

git clone https://github.com/RobotsAndPencils/xcodes.git
cd xcodes
git checkout -b interstateone-116-fuzzy-install-uninstall master
git pull https://github.com/interstateone/xcodes.git 116-fuzzy-install-uninstall

Right now there's a 12.3 beta available, and with this change you should be able to install it without specifying the beta identifier:

swift run xcodes update
swift run xcodes install 12.3

The tests that were added provide examples of how this should work in other situations, and you can try out the install and uninstall commands to verify. If there's an exact match even if there are multiple possible matches (like 12.2, when 12.2, 12.2 beta 1, 12.2 beta 2, 12.2 beta 3, and 12.2 release candidate are available) then it'll match 12.2. Once the next 12.3 beta is released then 12.3 is no longer unambiguous and would fail to match.

Closes #116.

@thii
Copy link
Contributor

thii commented Nov 15, 2020

Thanks for this.

Copy link
Contributor

@senmu senmu left a comment

Choose a reason for hiding this comment

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

Code changes look great and thanks for the easy to follow testing instructions. Installing the 12.3 beta using fuzzy matching worked for me.

@interstateone interstateone merged commit 8a56f58 into XcodesOrg:master Nov 17, 2020
@interstateone interstateone deleted the 116-fuzzy-install-uninstall branch November 17, 2020 19: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.

Allow installing and uninstalling prerelease versions without prerelease identifiers
3 participants