mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Merge pull request #5922 from rtpHarry/orchardexe-help-filter
Make orchard help command more intuitive Closes #422
This commit is contained in:
@@ -37,12 +37,15 @@ namespace Orchard.Commands.Builtin {
|
||||
[CommandHelp("help <command>\r\n\t" + "Display help text for <command>")]
|
||||
public void SingleCommand(string[] commandNameStrings) {
|
||||
string command = string.Join(" ", commandNameStrings);
|
||||
var descriptor = _commandManager.GetCommandDescriptors().SingleOrDefault(d => string.Equals(command, d.Name, StringComparison.OrdinalIgnoreCase));
|
||||
if (descriptor == null) {
|
||||
var descriptors = _commandManager.GetCommandDescriptors().Where(t => t.Name.StartsWith(command, StringComparison.OrdinalIgnoreCase)).OrderBy(d => d.Name);
|
||||
if (!descriptors.Any()) {
|
||||
Context.Output.WriteLine(T("Command {0} doesn't exist").ToString(), command);
|
||||
}
|
||||
else {
|
||||
Context.Output.WriteLine(GetHelpText(descriptor));
|
||||
foreach (var descriptor in descriptors) {
|
||||
Context.Output.WriteLine(GetHelpText(descriptor));
|
||||
Context.Output.WriteLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user