mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-01 01:25:27 +08:00 
			
		
		
		
	Added command description to command help message (#920)
This commit is contained in:
		| @@ -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(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 nkochnev
					nkochnev