mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-06-19 21:38: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:
@ -0,0 +1,20 @@
|
||||
using System.ComponentModel;
|
||||
using Spectre.Console.Cli;
|
||||
|
||||
namespace Spectre.Console.Tests.Data
|
||||
{
|
||||
public sealed class HiddenOptionSettings : CommandSettings
|
||||
{
|
||||
[CommandArgument(0, "<FOO>")]
|
||||
[Description("Dummy argument FOO")]
|
||||
public int Foo { get; set; }
|
||||
|
||||
[CommandOption("--bar", IsHidden = true)]
|
||||
[Description("You should not be able to read this unless you used the 'cli explain' command with the '--hidden' option")]
|
||||
public int Bar { get; set; }
|
||||
|
||||
[CommandOption("--baz")]
|
||||
[Description("Dummy option BAZ")]
|
||||
public int Baz { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user