Skip to content

Commit f3b7dbf

Browse files
committed
Renamed handlers
1 parent 554a682 commit f3b7dbf

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/FSharp.SystemCommandLine/CommandBuilders.fs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
149149
spec.SubCommands |> List.iter cmd.AddCommand
150150
cmd
151151

152-
/// Sets a command handler that returns unit.
153-
member this.SetActionHandler (spec: CommandSpec<'Inputs, unit>) (cmd: Command) =
152+
/// Sets a command handler that returns `unit`.
153+
member this.SetHandlerUnit (spec: CommandSpec<'Inputs, unit>) (cmd: Command) =
154154
let handler (args: obj) = spec.Handler (args :?> 'Inputs)
155155

156156
let valueDescriptors =
@@ -178,8 +178,8 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
178178
| _ -> raise (NotImplementedException())
179179
cmd
180180

181-
/// Sets a command handler that returns a status code.
182-
member this.SetFuncHandlerSync (spec: CommandSpec<'Inputs, int>) (cmd: Command) =
181+
/// Sets a command handler that returns an `int` status code.
182+
member this.SetFuncHandlerInt (spec: CommandSpec<'Inputs, int>) (cmd: Command) =
183183
let handler (args: obj) =
184184
spec.Handler (args :?> 'Inputs)
185185

@@ -246,8 +246,8 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
246246
| _ -> raise (NotImplementedException())
247247
cmd
248248

249-
/// Sets a command handler that returns a Task.
250-
member this.SetFuncHandlerAsync (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) (cmd: Command) =
249+
/// Sets a command handler that returns a `Task`.
250+
member this.SetFuncHandlerTask (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) (cmd: Command) =
251251
let handler (args: obj) =
252252
task {
253253
return! spec.Handler (args :?> 'Inputs)
@@ -297,23 +297,23 @@ type RootCommandParserBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M
297297
member this.Run (spec: CommandSpec<'Inputs, unit>) =
298298
this.CommandLineBuilder.Command
299299
|> this.SetGeneralProperties spec
300-
|> this.SetActionHandler spec
300+
|> this.SetHandlerUnit spec
301301
|> ignore
302302
this.CommandLineBuilder.Build()
303303

304304
/// Executes a Command with a handler that returns int.
305305
member this.Run (spec: CommandSpec<'Inputs, int>) =
306306
this.CommandLineBuilder.Command
307307
|> this.SetGeneralProperties spec
308-
|> this.SetFuncHandlerSync spec
308+
|> this.SetFuncHandlerInt spec
309309
|> ignore
310310
this.CommandLineBuilder.Build()
311311

312312
/// Executes a Command with a handler that returns a Task<unit> or Task<int>.
313313
member this.Run (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) =
314314
this.CommandLineBuilder.Command
315315
|> this.SetGeneralProperties spec
316-
|> this.SetFuncHandlerAsync spec
316+
|> this.SetFuncHandlerTask spec
317317
|> ignore
318318
this.CommandLineBuilder.Build()
319319

@@ -336,23 +336,23 @@ type RootCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
336336
member this.Run (spec: CommandSpec<'Inputs, unit>) =
337337
this.CommandLineBuilder.Command
338338
|> this.SetGeneralProperties spec
339-
|> this.SetActionHandler spec
339+
|> this.SetHandlerUnit spec
340340
|> ignore
341341
this.CommandLineBuilder.Build().Parse(args).Invoke()
342342

343343
/// Executes a Command with a handler that returns int.
344344
member this.Run (spec: CommandSpec<'Inputs, int>) =
345345
this.CommandLineBuilder.Command
346346
|> this.SetGeneralProperties spec
347-
|> this.SetFuncHandlerSync spec
347+
|> this.SetFuncHandlerInt spec
348348
|> ignore
349349
this.CommandLineBuilder.Build().Parse(args).Invoke()
350350

351351
/// Executes a Command with a handler that returns a Task<unit> or Task<int>.
352352
member this.Run (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) =
353353
this.CommandLineBuilder.Command
354354
|> this.SetGeneralProperties spec
355-
|> this.SetFuncHandlerAsync spec
355+
|> this.SetFuncHandlerTask spec
356356
|> ignore
357357
this.CommandLineBuilder.Build().Parse(args).InvokeAsync()
358358

@@ -365,19 +365,19 @@ type CommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N, 'O,
365365
member this.Run (spec: CommandSpec<'Inputs, unit>) =
366366
Command(name)
367367
|> this.SetGeneralProperties spec
368-
|> this.SetActionHandler spec
368+
|> this.SetHandlerUnit spec
369369

370370
/// Executes a Command with a handler that returns int.
371371
member this.Run (spec: CommandSpec<'Inputs, int>) =
372372
Command(name)
373373
|> this.SetGeneralProperties spec
374-
|> this.SetFuncHandlerSync spec
374+
|> this.SetFuncHandlerInt spec
375375

376376
/// Executes a Command with a handler that returns a Task<unit> or Task<int>.
377377
member this.Run (spec: CommandSpec<'Inputs, Task<'ReturnValue>>) =
378378
Command(name)
379379
|> this.SetGeneralProperties spec
380-
|> this.SetFuncHandlerAsync spec
380+
|> this.SetFuncHandlerTask spec
381381

382382

383383
/// Builds a `System.CommandLine.RootCommand` using computation expression syntax.

0 commit comments

Comments
 (0)