From 010c1fc003d7c7573f8c87d250836a40d1f600cf Mon Sep 17 00:00:00 2001 From: artesmichael Date: Mon, 1 Dec 2025 22:26:25 +0100 Subject: [PATCH] Added quiet flag to hide progress animation during install --- Sources/Swiftly/Install.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Sources/Swiftly/Install.swift b/Sources/Swiftly/Install.swift index f59e9f69..8bf17144 100644 --- a/Sources/Swiftly/Install.swift +++ b/Sources/Swiftly/Install.swift @@ -59,6 +59,9 @@ struct Install: SwiftlyCommand { help: "Verify (or not) the toolchain's PGP signature before proceeding with installation." ) var verify = true + + @Flag(name: .shortAndLong, help: "Hides the install progress animation.") + var quiet = false @Option( help: ArgumentHelp( @@ -87,7 +90,7 @@ struct Install: SwiftlyCommand { @OptionGroup var root: GlobalOptions private enum CodingKeys: String, CodingKey { - case version, use, verify, postInstallFile, root, progressFile, format + case version, use, verify, postInstallFile, root, progressFile, format, quiet } mutating func run() async throws { @@ -118,7 +121,8 @@ struct Install: SwiftlyCommand { verifySignature: self.verify, verbose: self.root.verbose, assumeYes: self.root.assumeYes, - progressFile: self.progressFile + progressFile: self.progressFile, + hideProgressAnimation: quiet ) if pathChanged { @@ -248,7 +252,8 @@ struct Install: SwiftlyCommand { verifySignature: Bool, verbose: Bool, assumeYes: Bool, - progressFile: FilePath? = nil + progressFile: FilePath? = nil, + hideProgressAnimation: Bool = false ) async throws -> (postInstall: String?, pathChanged: Bool) { guard !config.installedToolchains.contains(version) else { let installInfo = InstallInfo( @@ -309,8 +314,10 @@ struct Install: SwiftlyCommand { } let animation: ProgressReporterProtocol? = - if let progressFile + if hideProgressAnimation { + nil + } else if let progressFile { try JsonFileProgressReporter(ctx, filePath: progressFile) } else if ctx.format == .json { ConsoleProgressReporter(stream: stderrStream, header: "Downloading \(version)")