From 72cf3685d1e6fb05a948b23cd53cce2a53c0303c Mon Sep 17 00:00:00 2001 From: Paul LeMarquand Date: Wed, 14 May 2025 10:35:00 -0400 Subject: [PATCH 1/2] 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. --- Sources/MacOSPlatform/MacOS.swift | 4 +++- Sources/Swiftly/Uninstall.swift | 4 ++-- Tests/SwiftlyTests/RunTests.swift | 10 ++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sources/MacOSPlatform/MacOS.swift b/Sources/MacOSPlatform/MacOS.swift index dd72af1c..47f66bd1 100644 --- a/Sources/MacOSPlatform/MacOS.swift +++ b/Sources/MacOSPlatform/MacOS.swift @@ -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" diff --git a/Sources/Swiftly/Uninstall.swift b/Sources/Swiftly/Uninstall.swift index 75b9ff4f..a329142a 100644 --- a/Sources/Swiftly/Uninstall.swift +++ b/Sources/Swiftly/Uninstall.swift @@ -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 @@ -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 { diff --git a/Tests/SwiftlyTests/RunTests.swift b/Tests/SwiftlyTests/RunTests.swift index bf995b9c..a59c0f4d 100644 --- a/Tests/SwiftlyTests/RunTests.swift +++ b/Tests/SwiftlyTests/RunTests.swift @@ -68,15 +68,13 @@ import Testing #expect(["swift", "+1.2.3", "build"] == command) #expect(nil == selector) - do { + #expect(throws: SwiftlyError.self) { let _ = try Run.extractProxyArguments(command: ["+1.2.3"]) - #expect(false) - } catch {} + } - do { + #expect(throws: SwiftlyError.self) { let _ = try Run.extractProxyArguments(command: []) - #expect(false) - } catch {} + } (command, selector) = try Run.extractProxyArguments(command: ["swift", "+1.2.3", "build"]) #expect(["swift", "build"] == command) From 1b00854f9f5b3b66cd74b593d2e6db625fb1a771 Mon Sep 17 00:00:00 2001 From: Paul LeMarquand Date: Wed, 14 May 2025 13:26:56 -0400 Subject: [PATCH 2/2] Fixup ci --- Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md | 2 +- Tests/SwiftlyTests/RunTests.swift | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md b/Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md index fc2fb289..31e2fd1e 100644 --- a/Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md +++ b/Documentation/SwiftlyDocs.docc/swiftly-cli-reference.md @@ -232,7 +232,7 @@ swiftly uninstall [--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 diff --git a/Tests/SwiftlyTests/RunTests.swift b/Tests/SwiftlyTests/RunTests.swift index a59c0f4d..09546e18 100644 --- a/Tests/SwiftlyTests/RunTests.swift +++ b/Tests/SwiftlyTests/RunTests.swift @@ -69,11 +69,11 @@ import Testing #expect(nil == selector) #expect(throws: SwiftlyError.self) { - let _ = try Run.extractProxyArguments(command: ["+1.2.3"]) + try Run.extractProxyArguments(command: ["+1.2.3"]) } #expect(throws: SwiftlyError.self) { - let _ = try Run.extractProxyArguments(command: []) + try Run.extractProxyArguments(command: []) } (command, selector) = try Run.extractProxyArguments(command: ["swift", "+1.2.3", "build"])