File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ let main _ =
1010
1111 //ProgramAlt1.run ()
1212 //ProgramNoArgs.run ()
13- // ProgramNestedSubCommands.run () // Also contains global options
13+ ProgramNestedSubCommands.run () |> Async.AwaitTask |> Async.RunSynchronously // Also contains global options
1414 //ProgramSubCommand.run ()
1515 //ProgramTask.run ()
1616 //ProgramTokenReplacer.SCL.run ()
1717 //ProgramTokenReplacer.run ()
1818 //ProgramExtraInputs.run ()
19- ProgramAppendWords.run ()
19+ // ProgramAppendWords.run ()
Original file line number Diff line number Diff line change 33open System.IO
44open FSharp.SystemCommandLine
55open Input
6+ open System.Threading
67
78module Global =
8- let enableLogging = option " --enable-logging" |> def false
9- let logFile = option " --log-file" |> def ( FileInfo @" c:\temp\default.log" )
9+ let enableLogging = option " --enable-logging" |> recursive |> def false
10+ let logFile = option " --log-file" |> recursive |> def ( FileInfo @" c:\temp\default.log" )
1011
1112 type Options = { EnableLogging: bool ; LogFile: FileInfo }
1213
@@ -64,7 +65,7 @@ let deleteCmd =
6465let ioCmd =
6566 command " io" {
6667 description " Contains IO related subcommands."
67- noAction
68+ noAction
6869 addCommands [ deleteCmd; listCmd ]
6970 }
7071
@@ -73,17 +74,18 @@ let main (argv: string[]) =
7374 commandLineConfiguration {
7475 description " Sample app for System.CommandLine"
7576 noAction
76- addGlobalOptions Global.options
77+ addInputs Global.options
7778 addCommand ioCmd
7879 }
7980
80- //let parseResult = CommandLineParser.Parse(cfg.RootCommand, argv)
8181 let parseResult = cfg.Parse( argv)
8282
8383 let loggingEnabled = Global.enableLogging.GetValue parseResult
8484 printfn $" ROOT: Logging enabled: {loggingEnabled}"
8585
86- parseResult.Invoke()
86+ use cts = new CancellationTokenSource()
87+ let parseResult = cfg.Parse( argv)
88+ parseResult.InvokeAsync( cts.Token)
8789
8890let run () =
8991 " io list \" c:/data/\" --enable-logging" |> Utils.args |> main
You can’t perform that action at this time.
0 commit comments