Hide examples of hidden commands

This commit is contained in:
Christopher-Marcel Esser 2021-03-13 14:37:33 +01:00 committed by Patrik Svensson
parent e4dda283bb
commit 2540f48622
2 changed files with 4 additions and 2 deletions

View File

@ -46,7 +46,9 @@ namespace Spectre.Console.Tests.Unit.Cli
configurator.SetApplicationName("myapp");
configurator.AddCommand<DogCommand>("dog");
configurator.AddCommand<HorseCommand>("horse");
configurator.AddCommand<GiraffeCommand>("giraffe").IsHidden();
configurator.AddCommand<GiraffeCommand>("giraffe")
.WithExample(new[] { "giraffe", "123" })
.IsHidden();
});
// When

View File

@ -184,7 +184,7 @@ namespace Spectre.Console.Cli
{
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)
{