XcodesOrg / xcodes

The best command-line tool to install and switch between multiple versions of Xcode.
MIT License
3.6k stars 120 forks source link

Allow for version arguments to accept version matching operators #246

Open rogerluan opened 1 year ago

rogerluan commented 1 year ago

Hi 👋

It was brought up to my attention in this discussion https://github.com/fastlane/fastlane/issues/20866#issuecomment-1319016098 that xcversion and xcodes version resolvers work different. I started wondering whether xcodes accepts Ruby's Pessimistic Operator or an equivalent behavior (even if with a different syntax). If not, is this something we'd be interested in developing? It seems like there are users interested in it.

Thanks in advance!

mokagio commented 1 year ago

👋 Hi y'all

I posted about ~> in the Fastlane repo.

My two cents: This is not a required feature. I mentioned it only in the context of backward compatibility with the pre-xcodes behavior in the ensure_xcode_version Fastlane action.

The way I look at xcodes and its .xcode-version is the same as a lockfile such as Package.resolved or Podfile.lock. They define a specific version that the tool can use to ensure different machines will operate with the same version tools. Under that assumption, allowing users to specify a range of versions would not achieve the desired purpose, because there would be no way to ensure every machine runs the same version.

For what is worth, rbenv does not support the operator. I mention rbenv because it is a tool a non trivial portion of xcodes users would be familiar with because of the still relevant presence of Ruby tooling (e.g. Fastlane and CocoaPods).

# .ruby-version with content...
~> 2.7

# ...will throw the following error
rbenv: version `~>' is not installed (set by /work/directory/.ruby-version)