@@ -22,7 +22,7 @@ type CommandSpec<'Inputs, 'Output> =
2222 Description: string
2323 Inputs: HandlerInput list
2424 Handler: 'Inputs -> 'Output
25- Alias : string list
25+ Aliases : string list
2626 SubCommands: System .CommandLine .Command list
2727 /// Registers extra inputs that can be parsed via the InvocationContext if more than 8 are required.
2828 ExtraInputs: HandlerInput list
@@ -31,7 +31,7 @@ type CommandSpec<'Inputs, 'Output> =
3131 {
3232 Description = " My Command"
3333 Inputs = []
34- Alias = []
34+ Aliases = []
3535 ExtraInputs = []
3636 Handler = def< unit -> 'Output> // Support unit -> 'Output handler by default
3737 SubCommands = []
@@ -44,7 +44,7 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>() =
4444 {
4545 Description = spec.Description
4646 Inputs = spec.Inputs
47- Alias = spec.Alias
47+ Aliases = spec.Aliases
4848 ExtraInputs = spec.ExtraInputs
4949 Handler = handler
5050 SubCommands = spec.SubCommands
@@ -108,7 +108,7 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>() =
108108 member this.SetHandler ( spec : CommandSpec < 'Inputs , 'Output >, handler : 'Inputs -> 'Output ) =
109109 newHandler handler spec
110110
111- [<Obsolete( " 'setCommand' has been deprecated in favor of 'addCommand' or 'addCommands` ." ) >]
111+ [<Obsolete( " 'setCommand' has been deprecated in favor of 'addCommand' or 'addCommands' ." ) >]
112112 [<CustomOperation( " setCommand" ) >]
113113 member this.SetCommand ( spec : CommandSpec < 'Inputs , 'Output >, subCommand : System.CommandLine.Command ) =
114114 { spec with SubCommands = spec.SubCommands @ [ subCommand ] }
@@ -123,27 +123,41 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>() =
123123 member this.AddCommands ( spec : CommandSpec < 'Inputs , 'Output >, subCommands : System.CommandLine.Command seq ) =
124124 { spec with SubCommands = spec.SubCommands @ ( subCommands |> Seq.toList) }
125125
126- [<CustomOperation( " addAlias" ) >]
127- member this.AddAlias ( spec : CommandSpec < 'Inputs , 'Output >, alias : string seq ) =
128- { spec with Alias = spec.Alias @ ( alias |> Seq.toList) }
129-
126+ /// Adds an alias to the command.
130127 [<CustomOperation( " addAlias" ) >]
131128 member this.AddAlias ( spec : CommandSpec < 'Inputs , 'Output >, alias : string ) =
132- { spec with Alias = alias :: spec.Alias }
129+ { spec with Aliases = alias :: spec.Aliases }
133130
134- /// Registers an additional input that can be manually parsed via the InvocationContext. (Use when more than 8 inputs are required.)
131+ /// Adds aliases to the command.
132+ [<CustomOperation( " addAliases" ) >]
133+ member this.AddAliases ( spec : CommandSpec < 'Inputs , 'Output >, aliases : string seq ) =
134+ { spec with Aliases = spec.Aliases @ ( aliases |> Seq.toList) }
135+
136+ [<Obsolete( " 'add' has been deprecated in favor of 'addInput'." ) >]
135137 [<CustomOperation( " add" ) >]
136138 member this.Add ( spec : CommandSpec < 'Inputs , 'Output >, extraInput : HandlerInput < 'Value >) =
137139 { spec with ExtraInputs = spec.ExtraInputs @ [ extraInput ] }
138140
141+ [<Obsolete( " 'add' has been deprecated in favor of 'addInputs'." ) >]
139142 [<CustomOperation( " add" ) >]
140143 member this.Add ( spec : CommandSpec < 'Inputs , 'Output >, extraInput : HandlerInput seq ) =
141144 { spec with ExtraInputs = spec.ExtraInputs @ ( extraInput |> List.ofSeq) }
142145
146+ [<Obsolete( " 'add' has been deprecated in favor of 'addInputs'." ) >]
143147 [<CustomOperation( " add" ) >]
144148 member this.Add ( spec : CommandSpec < 'Inputs , 'Output >, extraInput : HandlerInput < 'Value > seq ) =
145149 { spec with ExtraInputs = spec.ExtraInputs @ ( extraInput |> Seq.cast |> List.ofSeq) }
146150
151+ /// Adds an extra input (when more than 8 inputs are required).
152+ [<CustomOperation( " addInput" ) >]
153+ member this.AddInput ( spec : CommandSpec < 'Inputs , 'Output >, extraInput : HandlerInput ) =
154+ { spec with ExtraInputs = spec.ExtraInputs @ [ extraInput ] }
155+
156+ /// Adds extra inputs (when more than 8 inputs are required).
157+ [<CustomOperation( " addInputs" ) >]
158+ member this.AddInputs ( spec : CommandSpec < 'Inputs , 'Output >, extraInputs : HandlerInput seq ) =
159+ { spec with ExtraInputs = spec.ExtraInputs @ ( extraInputs |> List.ofSeq) }
160+
147161 /// Sets general properties on the command.
148162 member this.SetGeneralProperties ( spec : CommandSpec < 'T , 'U >) ( cmd : Command ) =
149163 cmd.Description <- spec.Description
@@ -161,9 +175,8 @@ type BaseCommandBuilder<'A, 'B, 'C, 'D, 'E, 'F, 'G, 'H, 'Output>() =
161175 | ParsedArgument a -> cmd.AddArgument a
162176 | Context -> ()
163177 )
164-
165178 spec.SubCommands |> List.iter cmd.AddCommand
166- spec.Alias |> List.iter cmd.AddAlias
179+ spec.Aliases |> List.iter cmd.AddAlias
167180 cmd
168181
169182 /// Sets a command handler that returns ` unit ` .
0 commit comments