Skip to content

Commit 071ebf1

Browse files
authored
Cleanup Uninstall message (#356)
* Cleanup Uninstall message The uninstall message would print: `Uninstalling main-snapshot-2025-05-12...Uninstalling package in user home directory...` Clean it up so the second half only prints with `--verbose`. Also clean up a test assertion to make it more specific.
1 parent 4682b15 commit 071ebf1

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ swiftly uninstall <toolchain> [--assume-yes] [--verbose] [--version] [--help]
232232
*The toolchain(s) to uninstall.*
233233

234234

235-
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):
235+
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):
236236

237237
$ swiftly uninstall 5.2.1
238238

Sources/MacOSPlatform/MacOS.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ public struct MacOS: Platform {
148148
public func uninstall(_ ctx: SwiftlyCoreContext, _ toolchain: ToolchainVersion, verbose: Bool)
149149
async throws
150150
{
151-
await ctx.print("Uninstalling package in user home directory...")
151+
if verbose {
152+
await ctx.print("Uninstalling package in user home directory... ")
153+
}
152154

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

Sources/Swiftly/Uninstall.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Uninstall: SwiftlyCommand {
1212
1313
The toolchain selector provided determines which toolchains to uninstall. Specific \
1414
toolchains can be uninstalled by using their full names as the selector, for example \
15-
a full stable release version with patch (a.b.c):
15+
a full stable release version with patch (a.b.c):
1616
1717
$ swiftly uninstall 5.2.1
1818
@@ -129,7 +129,7 @@ struct Uninstall: SwiftlyCommand {
129129
}
130130

131131
static func execute(_ ctx: SwiftlyCoreContext, _ toolchain: ToolchainVersion, _ config: inout Config, verbose: Bool) async throws {
132-
await ctx.print("Uninstalling \(toolchain)...", terminator: "")
132+
await ctx.print("Uninstalling \(toolchain)... ", terminator: "")
133133
config.installedToolchains.remove(toolchain)
134134
// This is here to prevent the inUse from referencing a toolchain that is not installed
135135
if config.inUse == toolchain {

Tests/SwiftlyTests/RunTests.swift

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,13 @@ import Testing
6868
#expect(["swift", "+1.2.3", "build"] == command)
6969
#expect(nil == selector)
7070

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

76-
do {
77-
let _ = try Run.extractProxyArguments(command: [])
78-
#expect(false)
79-
} catch {}
75+
#expect(throws: SwiftlyError.self) {
76+
try Run.extractProxyArguments(command: [])
77+
}
8078

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

0 commit comments

Comments
 (0)