From cddffb08d24651ae8f5b5272a51e4e9af7c55c42 Mon Sep 17 00:00:00 2001 From: William Li Date: Tue, 4 Apr 2017 18:23:56 -0700 Subject: [PATCH] Refactoring: Move UsageText to a separate file --- .../commands/dotnet-help/HelpCommand.cs | 41 +---------------- .../commands/dotnet-help/HelpUsageText.cs | 44 +++++++++++++++++++ 2 files changed, 45 insertions(+), 40 deletions(-) create mode 100644 src/dotnet/commands/dotnet-help/HelpUsageText.cs diff --git a/src/dotnet/commands/dotnet-help/HelpCommand.cs b/src/dotnet/commands/dotnet-help/HelpCommand.cs index 7c12ac37d..9bff37221 100644 --- a/src/dotnet/commands/dotnet-help/HelpCommand.cs +++ b/src/dotnet/commands/dotnet-help/HelpCommand.cs @@ -8,53 +8,14 @@ using System.Runtime.InteropServices; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Cli; +using static HelpUsageText; namespace Microsoft.DotNet.Tools.Help { public class HelpCommand { - private static readonly string UsageText = $@"{LocalizableStrings.Usage}: dotnet [host-options] [command] [arguments] [common-options] - -{LocalizableStrings.Arguments}: - [command] {LocalizableStrings.CommandDefinition} - [arguments] {LocalizableStrings.ArgumentsDefinition} - [host-options] {LocalizableStrings.HostOptionsDefinition} - [common-options] {LocalizableStrings.OptionsDescription} - -{LocalizableStrings.CommonOptions}: - -v|--verbose {LocalizableStrings.VerboseDefinition} - -h|--help {LocalizableStrings.HelpDefinition} - -{LocalizableStrings.HostOptions}: - -d|--diagnostics {LocalizableStrings.DiagnosticsDefinition} - --version {LocalizableStrings.VersionDescription} - --info {LocalizableStrings.InfoDescription} - -{LocalizableStrings.Commands}: - new {LocalizableStrings.NewDefinition} - restore {LocalizableStrings.RestoreDefinition} - build {LocalizableStrings.BuildDefinition} - publish {LocalizableStrings.PublishDefinition} - run {LocalizableStrings.RunDefinition} - test {LocalizableStrings.TestDefinition} - pack {LocalizableStrings.PackDefinition} - migrate {LocalizableStrings.MigrateDefinition} - clean {LocalizableStrings.CleanDefinition} - sln {LocalizableStrings.SlnDefinition} - -Project modification commands: - add Add items to the project - remove Remove items from the project - list List items in the project - -{LocalizableStrings.AdvancedCommands}: - nuget {LocalizableStrings.NugetDefinition} - msbuild {LocalizableStrings.MsBuildDefinition} - vstest {LocalizableStrings.VsTestDefinition}"; - public static int Run(string[] args) { - CommandLineApplication app = new CommandLineApplication(throwOnUnexpectedArg: false); app.Name = "dotnet help"; app.FullName = LocalizableStrings.AppFullName; diff --git a/src/dotnet/commands/dotnet-help/HelpUsageText.cs b/src/dotnet/commands/dotnet-help/HelpUsageText.cs new file mode 100644 index 000000000..f1f2f39a5 --- /dev/null +++ b/src/dotnet/commands/dotnet-help/HelpUsageText.cs @@ -0,0 +1,44 @@ +using Microsoft.DotNet.Tools.Help; + +internal static class HelpUsageText +{ + public static readonly string UsageText = + $@"{LocalizableStrings.Usage}: dotnet [host-options] [command] [arguments] [common-options] + +{LocalizableStrings.Arguments}: + [command] {LocalizableStrings.CommandDefinition} + [arguments] {LocalizableStrings.ArgumentsDefinition} + [host-options] {LocalizableStrings.HostOptionsDefinition} + [common-options] {LocalizableStrings.OptionsDescription} + +{LocalizableStrings.CommonOptions}: + -v|--verbose {LocalizableStrings.VerboseDefinition} + -h|--help {LocalizableStrings.HelpDefinition} + +{LocalizableStrings.HostOptions}: + -d|--diagnostics {LocalizableStrings.DiagnosticsDefinition} + --version {LocalizableStrings.VersionDescription} + --info {LocalizableStrings.InfoDescription} + +{LocalizableStrings.Commands}: + new {LocalizableStrings.NewDefinition} + restore {LocalizableStrings.RestoreDefinition} + build {LocalizableStrings.BuildDefinition} + publish {LocalizableStrings.PublishDefinition} + run {LocalizableStrings.RunDefinition} + test {LocalizableStrings.TestDefinition} + pack {LocalizableStrings.PackDefinition} + migrate {LocalizableStrings.MigrateDefinition} + clean {LocalizableStrings.CleanDefinition} + sln {LocalizableStrings.SlnDefinition} + +Project modification commands: + add Add items to the project + remove Remove items from the project + list List items in the project + +{LocalizableStrings.AdvancedCommands}: + nuget {LocalizableStrings.NugetDefinition} + msbuild {LocalizableStrings.MsBuildDefinition} + vstest {LocalizableStrings.VsTestDefinition}"; +} \ No newline at end of file