Skip to content

Commit c4ee5d4

Browse files
committed
Fixes issue #32
1 parent 3844cc1 commit c4ee5d4

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/FSharp.SystemCommandLine/CommandBuilders.fs

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,14 +346,22 @@ type CommandLineConfigurationBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>()
346346
|> ignore
347347
this.CommandLineConfiguration
348348

349-
/// Executes a Command with a handler that returns a Task<unit> or Task<int>.
350-
member this.Run (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) =
349+
/// Executes a Command with a handler that returns a Task<unit>.
350+
member this.Run (spec: CommandSpec<'Inputs, Task<unit>>) =
351351
this.CommandLineConfiguration.RootCommand
352352
|> this.SetGeneralProperties spec
353353
|> this.SetHandlerTask spec
354354
|> ignore
355355
this.CommandLineConfiguration
356356

357+
/// Executes a Command with a handler that returns a Task<int>.
358+
member this.Run (spec: CommandSpec<'Inputs, Task<int>>) =
359+
this.CommandLineConfiguration.RootCommand
360+
|> this.SetGeneralProperties spec
361+
|> this.SetHandlerTaskInt spec
362+
|> ignore
363+
this.CommandLineConfiguration
364+
357365

358366
/// Builds and executes a `System.CommandLine.RootCommand`.
359367
type RootCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>(args: string array) =
@@ -439,12 +447,18 @@ type CommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>(name: string) =
439447
|> this.SetGeneralProperties spec
440448
|> this.SetHandlerInt spec
441449

442-
/// Executes a Command with a handler that returns a Task<unit> or Task<int>.
443-
member this.Run (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) =
450+
/// Executes a Command with a handler that returns a Task<unit>.
451+
member this.Run (spec: CommandSpec<'Inputs, Task<unit>>) =
444452
Command(name)
445453
|> this.SetGeneralProperties spec
446454
|> this.SetHandlerTask spec
447455

456+
/// Executes a Command with a handler that returns a Task<int>.
457+
member this.Run (spec: CommandSpec<'Inputs, Task<int>>) =
458+
Command(name)
459+
|> this.SetGeneralProperties spec
460+
|> this.SetHandlerTaskInt spec
461+
448462

449463
/// Builds a `System.CommandLineConfiguration` that can be passed to the `CommandLineParser.Parse` static method using computation expression syntax.
450464
let commandLineConfiguration<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output> =

0 commit comments

Comments
 (0)