From 6c2ebac49220de354111f28f62eada7619e0f748 Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Mon, 10 Feb 2025 10:57:40 -0500 Subject: [PATCH 1/2] Handle run with the --help flag so that it brings up the help --- Sources/Swiftly/Run.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Sources/Swiftly/Run.swift b/Sources/Swiftly/Run.swift index 474f23d1..0d64accd 100644 --- a/Sources/Swiftly/Run.swift +++ b/Sources/Swiftly/Run.swift @@ -56,6 +56,12 @@ internal struct Run: SwiftlyCommand { internal mutating func run() async throws { try validateSwiftly() + // Handle the specific case where help is requested of the run subcommand + if command == ["--help"] { + print(Run.helpMessage(for: Run.self)) + Foundation.exit(0) + } + var config = try Config.load() let (command, selector) = try extractProxyArguments(command: self.command) From b0ec2b8cba2c25b6f1b6071f23686dfd3b21c9af Mon Sep 17 00:00:00 2001 From: Chris McGee Date: Mon, 10 Feb 2025 12:27:27 -0500 Subject: [PATCH 2/2] Use the CleanExit API instead of manually printing the help message --- Sources/Swiftly/Run.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sources/Swiftly/Run.swift b/Sources/Swiftly/Run.swift index 0d64accd..a9747826 100644 --- a/Sources/Swiftly/Run.swift +++ b/Sources/Swiftly/Run.swift @@ -58,8 +58,7 @@ internal struct Run: SwiftlyCommand { // Handle the specific case where help is requested of the run subcommand if command == ["--help"] { - print(Run.helpMessage(for: Run.self)) - Foundation.exit(0) + throw CleanExit.helpRequest(self) } var config = try Config.load()