mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 05:18:16 +08:00
Added the ability to hide CommandOptions. (#642)
CommandOptions now has an IsHidden property that, when set to true, will cause the option to be hidden from the following cases: - Help text using `-h|--help` - Xml representations generated with the `cli xml` command - Diagnostics displayed with the `cli explain` command Hidden options can still be outputted with `cli explain` using the `--hidden` option that is also used to display hidden commands. Fixes #631
This commit is contained in:
@ -53,6 +53,15 @@ There is a special mode for `CommandOptions` on boolean types. Typically all `Co
|
||||
public bool Debug { get; set; }
|
||||
```
|
||||
|
||||
### Hidden options
|
||||
|
||||
`CommandOptions` can be hidden from being rendered in help by setting `IsHidden` to `true`.
|
||||
|
||||
```csharp
|
||||
[CommandOption("--hidden-opt", IsHidden = true)]
|
||||
public bool HiddenOpt { get; set; }
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
When rendering help the [`System.ComponentModel.Description`](https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.descriptionattribute?view=net-5.0) attribute is supported for specifying the text displayed to the user for both `CommandOption` and `CommandArgument`.
|
||||
|
Reference in New Issue
Block a user