mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-17 17:32:50 +08:00
Hide examples of hidden commands
This commit is contained in:
parent
e4dda283bb
commit
2540f48622
@ -46,7 +46,9 @@ namespace Spectre.Console.Tests.Unit.Cli
|
|||||||
configurator.SetApplicationName("myapp");
|
configurator.SetApplicationName("myapp");
|
||||||
configurator.AddCommand<DogCommand>("dog");
|
configurator.AddCommand<DogCommand>("dog");
|
||||||
configurator.AddCommand<HorseCommand>("horse");
|
configurator.AddCommand<HorseCommand>("horse");
|
||||||
configurator.AddCommand<GiraffeCommand>("giraffe").IsHidden();
|
configurator.AddCommand<GiraffeCommand>("giraffe")
|
||||||
|
.WithExample(new[] { "giraffe", "123" })
|
||||||
|
.IsHidden();
|
||||||
});
|
});
|
||||||
|
|
||||||
// When
|
// When
|
||||||
|
@ -184,7 +184,7 @@ namespace Spectre.Console.Cli
|
|||||||
{
|
{
|
||||||
var current = queue.Dequeue();
|
var current = queue.Dequeue();
|
||||||
|
|
||||||
foreach (var cmd in current.Commands)
|
foreach (var cmd in current.Commands.Where(x => !x.IsHidden))
|
||||||
{
|
{
|
||||||
if (cmd.Examples.Count > 0)
|
if (cmd.Examples.Count > 0)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user