We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b594bf2 commit 8d65041Copy full SHA for 8d65041
1 file changed
README.md
@@ -389,11 +389,23 @@ let ioCmd =
389
390
[<EntryPoint>]
391
let main argv =
392
- rootCommand argv {
393
- description "Sample app for System.CommandLine"
394
- setHandler id
395
- addCommand ioCmd
396
- }
+ let ctx = Input.Context()
+
+ let parser =
+ rootCommandParser {
+ 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()
409
```
410
411
### Database Migrations Example
0 commit comments