From 0f93e120c3041f94398140ef08ff8a4e0b31fe32 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Mon, 26 Apr 2010 18:13:19 -0700 Subject: [PATCH] Make orchard.exe help slightly more presentable --HG-- branch : dev --- .../Commands/TenantCommand.cs | 8 ++++---- src/Orchard/Commands/Builtin/HelpCommand.cs | 13 ++++++++++--- src/Tools/Orchard/OrchardHost.cs | 19 +++++++++++-------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.MultiTenancy/Commands/TenantCommand.cs b/src/Orchard.Web/Modules/Orchard.MultiTenancy/Commands/TenantCommand.cs index c5eed01f3..76b59ea1e 100644 --- a/src/Orchard.Web/Modules/Orchard.MultiTenancy/Commands/TenantCommand.cs +++ b/src/Orchard.Web/Modules/Orchard.MultiTenancy/Commands/TenantCommand.cs @@ -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 /Host: /UrlPrefix:" + - ": create new tenant named on the site")] + [CommandHelp("tenant add /Host: /UrlPrefix:\r\n\t" + + "Create new tenant named 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 : Display settings for a tenant")] + [CommandHelp("tenant info \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(); diff --git a/src/Orchard/Commands/Builtin/HelpCommand.cs b/src/Orchard/Commands/Builtin/HelpCommand.cs index 7558bca52..9240623e3 100644 --- a/src/Orchard/Commands/Builtin/HelpCommand.cs +++ b/src/Orchard/Commands/Builtin/HelpCommand.cs @@ -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 : Display help text for ")] + [CommandHelp("help \r\n\t" + "Display help text for ")] public void SingleCommand(string[] commandNameStrings) { string command = string.Join(" ", commandNameStrings); var descriptor = _commandManager.GetCommandDescriptors().SingleOrDefault(d => string.Equals(command, d.Name, StringComparison.OrdinalIgnoreCase)); diff --git a/src/Tools/Orchard/OrchardHost.cs b/src/Tools/Orchard/OrchardHost.cs index a4a96a24f..69cb88dec 100644 --- a/src/Tools/Orchard/OrchardHost.cs +++ b/src/Tools/Orchard/OrchardHost.cs @@ -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:"); + _output.WriteLine(" /wd:"); _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:"); + _output.WriteLine(" /vp:"); _output.WriteLine(" Virtual path to pass to the WebHost. Empty (i.e. root path) by default."); _output.WriteLine(""); _output.WriteLine(" /Tenant:tenant-name");