@@ -32,7 +32,7 @@ type CommandSpec<'Inputs, 'Output> =
3232 }
3333
3434/// Contains shared operations for building a ` RootCommand ` or ` Command ` .
35- type BaseCommandBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>() =
35+ type BaseCommandBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'Output >() =
3636
3737 let newHandler handler spec =
3838 {
@@ -86,38 +86,6 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
8686 member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >)) =
8787 { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h ] }
8888
89- [<CustomOperation( " inputs" ) >]
90- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >)) =
91- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i ] }
92-
93- [<CustomOperation( " inputs" ) >]
94- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >)) =
95- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j ] }
96-
97- [<CustomOperation( " inputs" ) >]
98- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >, k : HI < 'K >)) =
99- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J * 'K -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j; k ] }
100-
101- [<CustomOperation( " inputs" ) >]
102- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >, k : HI < 'K >, l : HI < 'L >)) =
103- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J * 'K * 'L -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j; k; l ] }
104-
105- [<CustomOperation( " inputs" ) >]
106- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >, k : HI < 'K >, l : HI < 'L >, m : HI < 'M >)) =
107- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J * 'K * 'L * 'M -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j; k; l; m ] }
108-
109- [<CustomOperation( " inputs" ) >]
110- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >, k : HI < 'K >, l : HI < 'L >, m : HI < 'M >, n : HI < 'N >)) =
111- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J * 'K * 'L * 'M * 'N -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j; k; l; m; n ] }
112-
113- [<CustomOperation( " inputs" ) >]
114- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >, k : HI < 'K >, l : HI < 'L >, m : HI < 'M >, n : HI < 'N >, o : HI < 'O >)) =
115- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J * 'K * 'L * 'M * 'N * 'O -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j; k; l; m; n; o ] }
116-
117- [<CustomOperation( " inputs" ) >]
118- member this.Inputs ( spec : CommandSpec < 'T , 'Output >, ( a : HI < 'A >, b : HI < 'B >, c : HI < 'C >, d : HI < 'D >, e : HI < 'E >, f : HI < 'F >, g : HI < 'G >, h : HI < 'H >, i : HI < 'I >, j : HI < 'J >, k : HI < 'K >, l : HI < 'L >, m : HI < 'M >, n : HI < 'N >, o : HI < 'O >, p : HI < 'P >)) =
119- { newHandler def< 'A * 'B * 'C * 'D * 'E * 'F * 'G * 'H * 'I * 'J * 'K * 'L * 'M * 'N * 'O * 'P -> 'Output> spec with Inputs = [ a; b; c; d; e; f; g; h; i; j; k; l; m; n; o; p ] }
120-
12189 [<CustomOperation( " setHandler" ) >]
12290 member this.SetHandler ( spec : CommandSpec < 'Inputs , 'Output >, handler : 'Inputs -> 'Output ) =
12391 newHandler handler spec
@@ -175,7 +143,7 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
175143 | 06 -> cmd.SetHandler( Action< 'A, 'B, 'C, 'D, 'E, 'F>( fun a b c d e f -> handler ( a, b, c, d, e, f)), cvd 0 , cvd 1 , cvd 2 , cvd 3 , cvd 4 , cvd 5 )
176144 | 07 -> cmd.SetHandler( Action< 'A, 'B, 'C, 'D, 'E, 'F, 'G>( fun a b c d e f g -> handler ( a, b, c, d, e, f, g)), cvd 0 , cvd 1 , cvd 2 , cvd 3 , cvd 4 , cvd 5 , cvd 6 )
177145 | 08 -> cmd.SetHandler( Action< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H>( fun a b c d e f g h -> handler ( a, b, c, d, e, f, g, h)), cvd 0 , cvd 1 , cvd 2 , cvd 3 , cvd 4 , cvd 5 , cvd 6 , cvd 7 )
178- | _ -> raise ( NotImplementedException())
146+ | _ -> raise ( NotImplementedException( " Only 8 inputs are supported. " ))
179147 cmd
180148
181149 /// Sets a command handler that returns an ` int ` status code.
@@ -190,7 +158,8 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
190158 | InjectedDependency -> ctx
191159
192160 match spec.Inputs.Length with
193- | 00 -> cmd.SetHandler( Action< IC>( fun ctx -> ctx.ExitCode <- handler ()))
161+ | 00 -> cmd.SetHandler( Action< IC>( fun ctx ->
162+ ctx.ExitCode <- handler ()))
194163 | 01 -> cmd.SetHandler( Action< IC>( fun ctx ->
195164 let a = getValue ctx 0 :?> 'A
196165 ctx.ExitCode <- handler ( a)))
@@ -243,7 +212,7 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
243212 let g = getValue ctx 6 :?> 'G
244213 let h = getValue ctx 7 :?> 'H
245214 ctx.ExitCode <- handler ( a, b, c, d, e, f, g, h)))
246- | _ -> raise ( NotImplementedException())
215+ | _ -> raise ( NotImplementedException( " Only 8 inputs are supported. " ))
247216 cmd
248217
249218 /// Sets a command handler that returns a ` Task ` .
@@ -275,13 +244,13 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
275244 | 06 -> cmd.SetHandler( Func< 'A, 'B, 'C, 'D, 'E, 'F, Task>( fun a b c d e f -> handler ( a, b, c, d, e, f)), cvd 0 , cvd 1 , cvd 2 , cvd 3 , cvd 4 , cvd 5 )
276245 | 07 -> cmd.SetHandler( Func< 'A, 'B, 'C, 'D, 'E, 'F, 'G, Task>( fun a b c d e f g -> handler ( a, b, c, d, e, f, g)), cvd 0 , cvd 1 , cvd 2 , cvd 3 , cvd 4 , cvd 5 , cvd 6 )
277246 | 08 -> cmd.SetHandler( Func< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, Task>( fun a b c d e f g h -> handler ( a, b, c, d, e, f, g, h)), cvd 0 , cvd 1 , cvd 2 , cvd 3 , cvd 4 , cvd 5 , cvd 6 , cvd 7 )
278- | _ -> raise ( NotImplementedException())
247+ | _ -> raise ( NotImplementedException( " Only 8 inputs are supported. " ))
279248 cmd
280249
281250
282251/// Builds a ` System.CommandLine.Parsing.Parser ` .
283- type RootCommandParserBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>() =
284- inherit BaseCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>()
252+ type RootCommandParserBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'Output >() =
253+ inherit BaseCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>()
285254
286255 [<CustomOperation( " usePipeline" ) >]
287256 member this.UsePipeline ( spec : CommandSpec < 'Inputs , 'Output >, subCommand : CommandLineBuilder -> unit ) =
@@ -319,8 +288,8 @@ type RootCommandParserBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M
319288
320289
321290/// Builds and executes a ` System.CommandLine.RootCommand ` .
322- type RootCommandBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>( args : string array ) =
323- inherit BaseCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>()
291+ type RootCommandBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'Output >( args : string array ) =
292+ inherit BaseCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>()
324293
325294 [<CustomOperation( " usePipeline" ) >]
326295 member this.UsePipeline ( spec : CommandSpec < 'Inputs , 'Output >, subCommand : CommandLineBuilder -> unit ) =
@@ -358,8 +327,8 @@ type RootCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N,
358327
359328
360329/// Builds a ` System.CommandLine.Command ` .
361- type CommandBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>( name : string ) =
362- inherit BaseCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>()
330+ type CommandBuilder < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'Output >( name : string ) =
331+ inherit BaseCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>()
363332
364333 /// Returns a Command with a handler that returns unit.
365334 member this.Run ( spec : CommandSpec < 'Inputs , unit >) =
@@ -381,13 +350,13 @@ type CommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I, 'J, 'K, 'L, 'M, 'N, 'O,
381350
382351
383352/// Builds a ` System.CommandLine.RootCommand ` using computation expression syntax.
384- let rootCommandParser < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output> =
385- RootCommandParserBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>()
353+ let rootCommandParser < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'Output > =
354+ RootCommandParserBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>()
386355
387356/// Builds and executes a ` System.CommandLine.RootCommand ` using computation expression syntax.
388- let rootCommand < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>( args : string array )=
389- RootCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>( args)
357+ let rootCommand < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'Output >( args : string array )=
358+ RootCommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>( args)
390359
391360/// Builds a ` System.CommandLine.Command ` using computation expression syntax.
392361let command < 'A , 'B , 'C , 'D , 'E , 'F , 'G , 'H , 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , 'Output > ( name : string ) =
393- CommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'I , 'J , 'K , 'L , 'M , 'N , 'O , 'P , ' Output>( name)
362+ CommandBuilder< 'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>( name)
0 commit comments