You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -198,6 +198,40 @@ let main argv =
198
198
|> Async.RunSynchronously
199
199
```
200
200
201
+
### Example with more than 8 inputs
202
+
Currently, a command handler function is limited to accept a tuple with no more than eight inputs.
203
+
If you need more, you can pass in the InvocationContext to your handler and manually get as many input values as you like (assuming they have been registered via the rootCommand or command builder's `add` operation:
204
+
205
+
```F#
206
+
module Program
207
+
208
+
open FSharp.SystemCommandLine
209
+
210
+
module Parameters =
211
+
let words = Input.Option<string[]>(["--word"; "-w"], Array.empty, "A list of words to be appended")
212
+
let separator = Input.OptionMaybe<string>(["--separator"; "-s"], "A character that will separate the joined words.")
213
+
214
+
let app (ctx: System.CommandLine.Invocation.InvocationContext) =
215
+
// Manually parse as many parameters as you need
216
+
let words = Parameters.words.GetValue ctx
217
+
let separator = Parameters.separator.GetValue ctx
218
+
219
+
// Do work
220
+
let separator = separator |> Option.defaultValue ", "
0 commit comments