File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ struct Run: SwiftlyCommand {
6363 var config = try await Config . load ( ctx)
6464
6565 // Handle the specific case where help is requested of the run subcommand
66- if command == [ " --help " ] {
66+ if command == [ " --help " ] || command == [ " -h " ] {
6767 throw CleanExit . helpRequest ( self )
6868 }
6969
Original file line number Diff line number Diff line change 1+ import ArgumentParser
12import Foundation
23@testable import Swiftly
34@testable import SwiftlyCore
@@ -84,4 +85,23 @@ import Testing
8485 #expect( [ " swift " , " build " ] == command)
8586 #expect( nil == selector)
8687 }
88+
89+ /// Tests the help functionality of the `run` command
90+ @Test ( . testHomeMockedToolchain( ) ) func runHelp( ) async throws {
91+ // Test --help is handled correctly
92+ do {
93+ try await SwiftlyTests . runCommand ( Run . self, [ " run " , " --help " ] )
94+ #expect( false )
95+ } catch {
96+ #expect( error is CleanExit )
97+ }
98+
99+ // Test -h is handled correctly
100+ do {
101+ try await SwiftlyTests . runCommand ( Run . self, [ " run " , " -h " ] )
102+ #expect( false )
103+ } catch {
104+ #expect( error is CleanExit )
105+ }
106+ }
87107}
You can’t perform that action at this time.
0 commit comments