Skip to content

Cleanup Uninstall message #356

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

Merged
merged 2 commits into from
May 16, 2025
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 Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ swiftly uninstall <toolchain> [--assume-yes] [--verbose] [--version] [--help]
*The toolchain(s) to uninstall.*


The toolchain selector provided determines which toolchains to uninstall. Specific toolchains can be uninstalled by using their full names as the selector, for example a full stable release version with patch (a.b.c):
The toolchain selector provided determines which toolchains to uninstall. Specific toolchains can be uninstalled by using their full names as the selector, for example a full stable release version with patch (a.b.c):

$ swiftly uninstall 5.2.1

Expand Down
4 changes: 3 additions & 1 deletion Sources/MacOSPlatform/MacOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ public struct MacOS: Platform {
public func uninstall(_ ctx: SwiftlyCoreContext, _ toolchain: ToolchainVersion, verbose: Bool)
async throws
{
await ctx.print("Uninstalling package in user home directory...")
if verbose {
await ctx.print("Uninstalling package in user home directory... ")
}

let toolchainDir = self.swiftlyToolchainsDir(ctx) / "\(toolchain.identifier).xctoolchain"

Expand Down
4 changes: 2 additions & 2 deletions Sources/Swiftly/Uninstall.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Uninstall: SwiftlyCommand {

The toolchain selector provided determines which toolchains to uninstall. Specific \
toolchains can be uninstalled by using their full names as the selector, for example \
a full stable release version with patch (a.b.c):
a full stable release version with patch (a.b.c):

$ swiftly uninstall 5.2.1

Expand Down Expand Up @@ -129,7 +129,7 @@ struct Uninstall: SwiftlyCommand {
}

static func execute(_ ctx: SwiftlyCoreContext, _ toolchain: ToolchainVersion, _ config: inout Config, verbose: Bool) async throws {
await ctx.print("Uninstalling \(toolchain)...", terminator: "")
await ctx.print("Uninstalling \(toolchain)... ", terminator: "")
config.installedToolchains.remove(toolchain)
// This is here to prevent the inUse from referencing a toolchain that is not installed
if config.inUse == toolchain {
Expand Down
14 changes: 6 additions & 8 deletions Tests/SwiftlyTests/RunTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,13 @@ import Testing
#expect(["swift", "+1.2.3", "build"] == command)
#expect(nil == selector)

do {
let _ = try Run.extractProxyArguments(command: ["+1.2.3"])
#expect(false)
} catch {}
#expect(throws: SwiftlyError.self) {
try Run.extractProxyArguments(command: ["+1.2.3"])
}

do {
let _ = try Run.extractProxyArguments(command: [])
#expect(false)
} catch {}
#expect(throws: SwiftlyError.self) {
try Run.extractProxyArguments(command: [])
}

(command, selector) = try Run.extractProxyArguments(command: ["swift", "+1.2.3", "build"])
#expect(["swift", "build"] == command)
Expand Down