@@ -3,28 +3,50 @@ module ProgramExtraInputs
33
44open FSharp.SystemCommandLine
55
6- module Parameters =
7- let words = Input.Option< string[]>([ " --word" ; " -w" ], Array.empty, " A list of words to be appended" )
8- let separator = Input.OptionMaybe< string>([ " --separator" ; " -s" ], " A character that will separate the joined words." )
6+ let a = Input.Option< string>( " -a" , defaultValue = " a?" )
7+ let b = Input.Option< string>( " -b" , defaultValue = " b?" )
8+ let c = Input.Option< string>( " -c" , defaultValue = " c?" )
9+ let d = Input.Option< string>( " -d" , defaultValue = " d?" )
10+ let e = Input.Option< string>( " -e" , defaultValue = " e?" )
11+ let f = Input.Option< int>( " -1" , defaultValue = 0 )
12+ let g = Input.Option< int>( " -2" , defaultValue = 0 )
13+ let h = Input.Option< int>( " -3" , defaultValue = 0 ) // NOTE: "-h" is taken via Help pipeline defaults
14+ let i = Input.Option< int>( " -4" , defaultValue = 0 )
15+ let j = Input.Option< int>( " -5" , defaultValue = 0 )
916
1017let app ( ctx : System.CommandLine.Invocation.InvocationContext ) =
11- // Manually parse parameters
12- let words = Parameters.words.GetValue ctx
13- let separator = Parameters.separator.GetValue ctx
14-
15- // Append words together
16- let separator = separator |> Option.defaultValue " , "
17- System.String.Join( separator, words) |> printfn " Result: %s "
18+ [
19+ a.GetValue ctx
20+ b.GetValue ctx
21+ c.GetValue ctx
22+ d.GetValue ctx
23+ e.GetValue ctx
24+ f.GetValue ctx |> string
25+ g.GetValue ctx |> string
26+ h.GetValue ctx |> string
27+ i.GetValue ctx |> string
28+ j.GetValue ctx |> string
29+ ]
30+ |> String.concat " , "
31+ |> printfn " Result: %s "
1832 0
1933
20- // [<EntryPoint>]
34+ [<EntryPoint>]
2135let main argv =
2236 let ctx = Input.Context()
2337
2438 rootCommand argv {
2539 description " Appends words together"
2640 inputs ctx
2741 setHandler app
28- add Parameters.words
29- add Parameters.separator
42+ add a
43+ add b
44+ add c
45+ add d
46+ add e
47+ add f
48+ add g
49+ add h
50+ add i
51+ add j
3052 }
0 commit comments