Added command description to command help message (#920)

This commit is contained in:
nkochnev
2022-08-17 19:59:08 +05:00
committed by GitHub
parent d94dc2fcb2
commit 78d841e3dc
6 changed files with 29 additions and 0 deletions

View File

@ -75,6 +75,7 @@ internal static class HelpWriter
var isDefaultCommand = command?.IsDefaultCommand ?? false;
var result = new List<IRenderable>();
result.AddRange(GetDescription(command));
result.AddRange(GetUsage(model, command));
result.AddRange(GetExamples(model, command));
result.AddRange(GetArguments(command));
@ -84,6 +85,19 @@ internal static class HelpWriter
return result;
}
private static IEnumerable<IRenderable> GetDescription(CommandInfo? command)
{
if (command?.Description == null)
{
yield break;
}
var composer = new Composer();
composer.Style("yellow", "DESCRIPTION:").LineBreak();
composer.Text(command.Description).LineBreak();
yield return composer.LineBreak();
}
private static IEnumerable<IRenderable> GetUsage(CommandModel model, CommandInfo? command)
{
var composer = new Composer();