Make orchard.exe help slightly more presentable

--HG--
branch : dev
This commit is contained in:
Renaud Paquay 2010-04-26 18:13:19 -07:00
parent 23236676ea
commit 0f93e120c3
3 changed files with 25 additions and 15 deletions

View File

@ -17,7 +17,7 @@ namespace Orchard.MultiTenancy.Commands {
[OrchardSwitch]
public string UrlPrefix { get; set; }
[CommandHelp("tenant list: Display current tenants of a site")]
[CommandHelp("tenant list\r\n\t" + "Display current tenants of a site")]
[CommandName("tenant list")]
public void List() {
Context.Output.WriteLine(T("List of tenants"));
@ -36,8 +36,8 @@ namespace Orchard.MultiTenancy.Commands {
}
}
[CommandHelp("tenant add <tenantName> /Host:<hostname> /UrlPrefix:<url prefix>" +
": create new tenant named <tenantName> on the site")]
[CommandHelp("tenant add <tenantName> /Host:<hostname> /UrlPrefix:<url prefix>\r\n\t" +
"Create new tenant named <tenantName> on the site")]
[CommandName("tenant add")]
public void Create(string tenantName) {
Context.Output.WriteLine(T("Creating tenant"));
@ -50,7 +50,7 @@ namespace Orchard.MultiTenancy.Commands {
});
}
[CommandHelp("tenant info <tenantName>: Display settings for a tenant")]
[CommandHelp("tenant info <tenantName>\r\n\t" + "Display settings for a tenant")]
[CommandName("tenant info")]
public void Info(string tenantName) {
ShellSettings tenant = _tenantService.GetTenants().Where(x => x.Name == tenantName).FirstOrDefault();

View File

@ -11,23 +11,30 @@ namespace Orchard.Commands.Builtin {
}
[CommandName("help commands")]
[CommandHelp("help commands: Display help text for all available commands")]
[CommandHelp("help commands\r\n\t" + "Display help text for all available commands")]
public void AllCommands() {
Context.Output.WriteLine(T("List of available commands:"));
Context.Output.WriteLine(T("---------------------------"));
Context.Output.WriteLine();
var descriptors = _commandManager.GetCommandDescriptors();
foreach (var descriptor in descriptors) {
Context.Output.WriteLine(GetHelpText(descriptor));
Context.Output.WriteLine();
}
}
private LocalizedString GetHelpText(CommandDescriptor descriptor) {
return string.IsNullOrEmpty(descriptor.HelpText) ? T("[no help text]") : T(descriptor.HelpText);
if (string.IsNullOrEmpty(descriptor.HelpText)) {
return T("{0}: no help text",
descriptor.MethodInfo.DeclaringType.FullName + "." + descriptor.MethodInfo.Name);
}
return T(descriptor.HelpText);
}
[CommandName("help")]
[CommandHelp("help <command>: Display help text for <command>")]
[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));

View File

@ -75,12 +75,15 @@ namespace Orchard {
_output.WriteLine("Executes Orchard commands from a Orchard installation directory.");
_output.WriteLine("");
_output.WriteLine("Usage:");
_output.WriteLine(" orchard.exe arg1 ... argn /switch1[:value1] ... /switchn[:valuen]");
_output.WriteLine(" orchard.exe command [arg1] ... [argn] [/switch1[:value1]] ... [/switchn[:valuen]]");
_output.WriteLine("");
_output.WriteLine(" arg1 ... argn");
_output.WriteLine(" Specify which command to execute and optional arguments");
_output.WriteLine(" command");
_output.WriteLine(" Specify the command to execute");
_output.WriteLine("");
_output.WriteLine(" /switch1[:value1] ... /switchn[:valuen]");
_output.WriteLine(" [arg1] ... [argn]");
_output.WriteLine(" Specify additional arguments for the command");
_output.WriteLine("");
_output.WriteLine(" [/switch1[:value1]] ... [/switchn[:valuen]]");
_output.WriteLine(" Specify switches to apply to the command. Available switches generally ");
_output.WriteLine(" depend on the command executed, with the exception of a few built-in ones.");
_output.WriteLine("");
@ -96,16 +99,16 @@ namespace Orchard {
_output.WriteLine(" Built-in switches");
_output.WriteLine(" =================");
_output.WriteLine("");
_output.WriteLine(" /WorkingDirectory");
_output.WriteLine(" /wd");
_output.WriteLine(" /WorkingDirectory:<physical-path>");
_output.WriteLine(" /wd:<physical-path>");
_output.WriteLine(" Specifies the orchard installation directory. The current directory is the default.");
_output.WriteLine("");
_output.WriteLine(" /Verbose");
_output.WriteLine(" /v");
_output.WriteLine(" Turn on verbose output");
_output.WriteLine("");
_output.WriteLine(" /VirtualPath");
_output.WriteLine(" /vp");
_output.WriteLine(" /VirtualPath:<virtual-path>");
_output.WriteLine(" /vp:<virtual-path>");
_output.WriteLine(" Virtual path to pass to the WebHost. Empty (i.e. root path) by default.");
_output.WriteLine("");
_output.WriteLine(" /Tenant:tenant-name");