File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed
Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -389,11 +389,23 @@ let ioCmd =
389389
390390[<EntryPoint>]
391391let main argv =
392- rootCommand argv {
393- description "Sample app for System.CommandLine"
394- setHandler id
395- addCommand ioCmd
396- }
392+ let ctx = Input.Context()
393+
394+ let parser =
395+ rootCommandParser {
396+ description "Sample app for System.CommandLine"
397+ setHandler id
398+ addGlobalOptions Global.options
399+ addCommand ioCmd
400+ }
401+
402+ let parseResult = parser.Parse(argv)
403+
404+ // Get global option value from the parseResult
405+ let loggingEnabled = Global.enableLogging.GetValue parseResult
406+ printfn $"ROOT: Logging enabled: {loggingEnabled}"
407+
408+ parseResult.Invoke()
397409```
398410
399411### Database Migrations Example
You can’t perform that action at this time.
0 commit comments