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 _ =
10
10
11
11
//ProgramAlt1.run ()
12
12
//ProgramNoArgs.run ()
13
- // ProgramNestedSubCommands.run () // Also contains global options
13
+ ProgramNestedSubCommands.run () |> Async.AwaitTask |> Async.RunSynchronously // Also contains global options
14
14
//ProgramSubCommand.run ()
15
15
//ProgramTask.run ()
16
16
//ProgramTokenReplacer.SCL.run ()
17
17
//ProgramTokenReplacer.run ()
18
18
//ProgramExtraInputs.run ()
19
- ProgramAppendWords.run ()
19
+ // ProgramAppendWords.run ()
Original file line number Diff line number Diff line change 3
3
open System.IO
4
4
open FSharp.SystemCommandLine
5
5
open Input
6
+ open System.Threading
6
7
7
8
module 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" )
10
11
11
12
type Options = { EnableLogging: bool ; LogFile: FileInfo }
12
13
@@ -64,7 +65,7 @@ let deleteCmd =
64
65
let ioCmd =
65
66
command " io" {
66
67
description " Contains IO related subcommands."
67
- noAction
68
+ noAction
68
69
addCommands [ deleteCmd; listCmd ]
69
70
}
70
71
@@ -73,17 +74,18 @@ let main (argv: string[]) =
73
74
commandLineConfiguration {
74
75
description " Sample app for System.CommandLine"
75
76
noAction
76
- addGlobalOptions Global.options
77
+ addInputs Global.options
77
78
addCommand ioCmd
78
79
}
79
80
80
- //let parseResult = CommandLineParser.Parse(cfg.RootCommand, argv)
81
81
let parseResult = cfg.Parse( argv)
82
82
83
83
let loggingEnabled = Global.enableLogging.GetValue parseResult
84
84
printfn $" ROOT: Logging enabled: {loggingEnabled}"
85
85
86
- parseResult.Invoke()
86
+ use cts = new CancellationTokenSource()
87
+ let parseResult = cfg.Parse( argv)
88
+ parseResult.InvokeAsync( cts.Token)
87
89
88
90
let run () =
89
91
" io list \" c:/data/\" --enable-logging" |> Utils.args |> main
You can’t perform that action at this time.
0 commit comments