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

use simpler 'release' instead of 'non-prerelease' word in user-facing… #239

Merged
merged 3 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ You'll need Xcode 13 in order to build and run xcodes.

<details>
<summary>Using Xcode</summary>
Even though xcodes is a command-line app, lll of the normal functionality works in Xcode, like building, running, and running tests. You can even type text into Xcode's console when it prompts you for input like your Apple ID or 2FA code.
Even though xcodes is a command-line app, all of the normal functionality works in Xcode, like building, running, and running tests. You can even type text into Xcode's console when it prompts you for input like your Apple ID or 2FA code.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed a small typo here. Not related to the PR, but would be nice to fix 🙏


When running xcodes from Xcode, if you want to run a particular command or pass some arguments, you can hold the option key to present a sheet with more options. This means you'd use <kbd>Option</kbd> + <kbd>Command</kbd> + <kbd>R</kbd> or hold <kbd>Option</kbd> while clicking the Run button. Here you can add, remove, and toggle arguments that will be passed to xcodes when it's launched.

Expand Down
19 changes: 10 additions & 9 deletions Sources/XcodesKit/XcodeInstaller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public final class XcodeInstaller {
case unsupportedFileFormat(extension: String)
case missingSudoerPassword
case unavailableVersion(Version)
case noNonPrereleaseVersionAvailable
case noReleaseVersionAvailable
case noPrereleaseVersionAvailable
case versionAlreadyInstalled(InstalledXcode)
case invalidVersion(String)
Expand Down Expand Up @@ -60,8 +60,8 @@ public final class XcodeInstaller {
return "Missing password. Please try again."
case let .unavailableVersion(version):
return "Could not find version \(version.appleDescription)."
case .noNonPrereleaseVersionAvailable:
return "No non-prerelease versions available."
case .noReleaseVersionAvailable:
return "No release versions available."
case .noPrereleaseVersionAvailable:
return "No prerelease versions available."
case let .versionAlreadyInstalled(installedXcode):
Expand Down Expand Up @@ -222,16 +222,17 @@ public final class XcodeInstaller {

return update(dataSource: dataSource)
.then { availableXcodes -> Promise<(Xcode, URL)> in
guard let latestNonPrereleaseXcode = availableXcodes.filter(\.version.isNotPrerelease).sorted(\.version).last else {
throw Error.noNonPrereleaseVersionAvailable
guard let latestReleaseXcode = availableXcodes.filter(\.version.isNotPrerelease).sorted(\.version).last else {
throw Error.noReleaseVersionAvailable
}
Current.logging.log("Latest non-prerelease version available is \(latestNonPrereleaseXcode.version.appleDescription)")

if willInstall, let installedXcode = Current.files.installedXcodes(destination).first(where: { $0.version.isEquivalent(to: latestNonPrereleaseXcode.version) }) {
Current.logging.log("Latest release version available is \(latestReleaseXcode.version.appleDescription)")

if willInstall, let installedXcode = Current.files.installedXcodes(destination).first(where: { $0.version.isEquivalent(to: latestReleaseXcode.version) }) {
throw Error.versionAlreadyInstalled(installedXcode)
}

return self.downloadXcode(version: latestNonPrereleaseXcode.version, dataSource: dataSource, downloader: downloader, willInstall: willInstall)
return self.downloadXcode(version: latestReleaseXcode.version, dataSource: dataSource, downloader: downloader, willInstall: willInstall)
}
case .latestPrerelease:
Current.logging.log("Updating...")
Expand All @@ -244,7 +245,7 @@ public final class XcodeInstaller {
.sorted(by: { $0.releaseDate! < $1.releaseDate! })
.last
else {
throw Error.noNonPrereleaseVersionAvailable
throw Error.noReleaseVersionAvailable
}
Current.logging.log("Latest prerelease version available is \(latestPrereleaseXcode.version.appleDescription)")

Expand Down
4 changes: 2 additions & 2 deletions Sources/xcodes/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ struct Xcodes: AsyncParsableCommand {
completion: .custom { args in xcodeList.availableXcodes.sorted { $0.version < $1.version }.map { $0.version.appleDescription } })
var version: [String] = []

@Flag(help: "Update and then download the latest non-prerelease version available.")
@Flag(help: "Update and then download the latest release version available.")
var latest: Bool = false

@Flag(help: "Update and then download the latest prerelease version available, including GM seeds and GMs.")
Expand Down Expand Up @@ -184,7 +184,7 @@ struct Xcodes: AsyncParsableCommand {
completion: .file(extensions: ["xip"]))
var pathString: String?

@Flag(help: "Update and then install the latest non-prerelease version available.")
@Flag(help: "Update and then install the latest release version available.")
var latest: Bool = false

@Flag(help: "Update and then install the latest prerelease version available, including GM seeds and GMs.")
Expand Down