Open Tyrrrz opened 2 years ago
Note: this is better implemented as another string
property on the CommandAttribute
, not as a type member as visualized in the original post.
Example usage:
[Command("foo", Examples = new[]
{
// Note: no need to add the command name here
"--bar 42",
"-b 42"
}
]
public class MyCommand : ICommand
{
// ...
}
The examples would then be shown in the "usage" section of the help text:
USAGE
dotnet myapp.dll foo [options]
dotnet myapp.dll foo --bar 42
dotnet myapp.dll foo -b 42
OPTIONS
-b|--bar Something.
-h|--help Shows help text.
Discussed in https://github.com/Tyrrrz/CliFx/discussions/114