dotnet / dotnet/command-line-api
Feature Request: Add Examples section in HelpBuilder.
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 428
- PR merge metrics
- No merged PRs in 30d
Description
The current help is generated based on the `Description` of `Command/Option or Argument.`
Most of cli tools provide examples in help.
It is needed to add a separate section appended to the current generated help for every Command.
The `Examples` can be a string property (like `Description`) in `CliCommand` to be used in configuring help examples every command.
In the article [Add or replace help sections](https://learn.microsoft.com/en-us/dotnet/standard/commandline/customize-help#add-or-replace-help-sections), we can add a new section , but it need to access a property Eg Examples
It is nice of that ExampleSection be part of `HelpBuilder` class .
Sample of the help with examples:
```
Description:
Read a file
Usage:
scl [options]
Options:
--file The file to print out. [default: scl.runtimeconfig.json]
--light-mode Determines whether the background color will be black or
white
--color Specifies the foreground color of console output
--version Show version information
-?, -h, --help Show help and usage information
Examples:
Example 1:
scl --file file.txt --color Cyan
Example 2: Using default color
scl --file file.txt
```
Contributor guide
Assessment
This issue has not been assessed yet.