Skip to content

Commit 7ccb27f

Browse files
committed
Clarify what RootCommand does
1 parent 3472eda commit 7ccb27f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/System.CommandLine/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ rootCommand.SetAction(parseResult =>
2929
return rootCommand.Parse(args).Invoke();
3030
```
3131

32+
In this example, we create a `RootCommand`, add an option for the user's name, and define an action that prints a greeting. The `RootCommand` is a special kind of `Command` that comes with a few predefined behaviors:
33+
34+
* It discovers its name automatically from the currently-running application
35+
* It automatically provides `--help` and `--version` options and default behaviors for them
36+
* It provides a default integration with `dotnet-suggest` for dynamic [shell completions](#shell-completions)
37+
38+
You can always override or customize these behaviors as needed on a `RootCommand`, or create your own top-level `Command` instead.
39+
3240
### Commands with Arguments
3341

3442
Arguments are values passed directly to commands without option names:

0 commit comments

Comments
 (0)