diff --git a/CliFx/Services/CommandHelpTextBuilder.cs b/CliFx/Services/CommandHelpTextBuilder.cs index 8c035c6..da4091c 100644 --- a/CliFx/Services/CommandHelpTextBuilder.cs +++ b/CliFx/Services/CommandHelpTextBuilder.cs @@ -124,17 +124,25 @@ namespace CliFx.Services buffer.AppendLine(); } - public string Build(IReadOnlyList commandSchemas, CommandSchema commandSchema) + public string Build(IReadOnlyList availableCommandSchemas, CommandSchema matchingCommandSchema) { var buffer = new StringBuilder(); - var subCommands = commandSchemas.FindSubCommandSchemas(commandSchema.Name); + var subCommands = availableCommandSchemas.FindSubCommandSchemas(matchingCommandSchema.Name); - AddDescription(buffer, commandSchema); - AddUsage(buffer, commandSchema, subCommands); - AddOptions(buffer, commandSchema); + AddDescription(buffer, matchingCommandSchema); + AddUsage(buffer, matchingCommandSchema, subCommands); + AddOptions(buffer, matchingCommandSchema); AddSubCommands(buffer, subCommands); + if (matchingCommandSchema.IsDefault() && subCommands.Any()) + { + buffer.Append("You can run "); + buffer.Append('`').Append(GetExeName()).Append(" [command] --help").Append('`'); + buffer.Append(" to show information for a specific command."); + buffer.AppendLine(); + } + return buffer.ToString().Trim(); } } diff --git a/CliFx/Services/ICommandHelpTextBuilder.cs b/CliFx/Services/ICommandHelpTextBuilder.cs index c789bd7..5b4c92c 100644 --- a/CliFx/Services/ICommandHelpTextBuilder.cs +++ b/CliFx/Services/ICommandHelpTextBuilder.cs @@ -5,6 +5,6 @@ namespace CliFx.Services { public interface ICommandHelpTextBuilder { - string Build(IReadOnlyList commandSchemas, CommandSchema commandSchema); + string Build(IReadOnlyList availableCommandSchemas, CommandSchema matchingCommandSchema); } } \ No newline at end of file