diff --git a/src/dotnet/commands/dotnet-pack/LocalizableStrings.cs b/src/dotnet/commands/dotnet-pack/LocalizableStrings.cs new file mode 100644 index 000000000..2e4f12153 --- /dev/null +++ b/src/dotnet/commands/dotnet-pack/LocalizableStrings.cs @@ -0,0 +1,33 @@ +namespace Microsoft.DotNet.Tools.Pack +{ + internal class LocalizableStrings + { + public const string AppFullName = "pack"; + + public const string AppDescription = "pack for msbuild"; + + public const string CmdOutputDir = "OUTPUT_DIR"; + + public const string CmdOutputDirDescription = "Directory in which to place outputs"; + + public const string CmdNoBuildOptionDescription = "Do not build project before packing"; + + public const string CmdIncludeSymbolsDescription = "Include PDBs along with the DLLs in the output folder"; + + public const string CmdIncludeSourceDescription = "Include PDBs and source files. Source files go into the src folder in the resulting nuget package"; + + public const string CmdConfig = "CONFIGURATION"; + + public const string CmdConfigDescription = "Configuration under which to build"; + + public const string CmdVersionSuffix = "VERSION_SUFFIX"; + + public const string CmdVersionSuffixDescription = "Defines what `*` should be replaced with in version field in project.json"; + + public const string CmdServiceableDescription = "Set the serviceable flag in the package"; + + public const string CmdArgumentProject = "PROJECT"; + + public const string CmdArgumentDescription = "The project to pack, defaults to the project file in the current directory. Can be a path to any project file"; + } +} diff --git a/src/dotnet/commands/dotnet-pack/PackCommand.cs b/src/dotnet/commands/dotnet-pack/PackCommand.cs index 30ea16179..d082f9773 100644 --- a/src/dotnet/commands/dotnet-pack/PackCommand.cs +++ b/src/dotnet/commands/dotnet-pack/PackCommand.cs @@ -17,37 +17,45 @@ namespace Microsoft.DotNet.Tools.Pack CommandLineApplication cmd = new CommandLineApplication(throwOnUnexpectedArg: false) { Name = "pack", - FullName = "pack", - Description = "pack for msbuild", + FullName = LocalizableStrings.AppFullName, + Description = LocalizableStrings.AppDescription, AllowArgumentSeparator = true, ArgumentSeparatorHelpText = HelpMessageStrings.MSBuildAdditionalArgsHelpText }; cmd.HelpOption("-h|--help"); - var output = cmd.Option("-o|--output ", - "Directory in which to place outputs", + var output = cmd.Option( + $"-o|--output <{LocalizableStrings.CmdOutputDir}>", + LocalizableStrings.CmdOutputDirDescription, CommandOptionType.SingleValue); - var noBuild = cmd.Option("--no-build", - "Do not build project before packing", + var noBuild = cmd.Option( + "--no-build", + LocalizableStrings.CmdNoBuildOptionDescription, CommandOptionType.NoValue); - var includeSymbols = cmd.Option("--include-symbols", - "Include PDBs along with the DLLs in the output folder", + var includeSymbols = cmd.Option( + "--include-symbols", + LocalizableStrings.CmdIncludeSymbolsDescription, CommandOptionType.NoValue); - var includeSource = cmd.Option("--include-source", - "Include PDBs and source files. Source files go into the src folder in the resulting nuget package", + var includeSource = cmd.Option( + "--include-source", + LocalizableStrings.CmdIncludeSourceDescription, CommandOptionType.NoValue); - var configuration = cmd.Option("-c|--configuration ", - "Configuration under which to build", + var configuration = cmd.Option( + $"-c|--configuration <{LocalizableStrings.CmdConfig}>", + LocalizableStrings.CmdConfigDescription, CommandOptionType.SingleValue); - var versionSuffix = cmd.Option("--version-suffix ", - "Defines what `*` should be replaced with in version field in project.json", + var versionSuffix = cmd.Option( + $"--version-suffix <{LocalizableStrings.CmdVersionSuffix}>", + LocalizableStrings.CmdVersionSuffixDescription, CommandOptionType.SingleValue); - var serviceable = cmd.Option("-s|--serviceable", - "Set the serviceable flag in the package", + var serviceable = cmd.Option( + "-s|--serviceable", + LocalizableStrings.CmdServiceableDescription, CommandOptionType.NoValue); - var argRoot = cmd.Argument("", - "The project to pack, defaults to the project file in the current directory. Can be a path to any project file", + var argRoot = cmd.Argument( + $"<{LocalizableStrings.CmdArgumentProject}>", + LocalizableStrings.CmdArgumentDescription, multipleValues:true); CommandOption verbosityOption = MSBuildForwardingApp.AddVerbosityOption(cmd); @@ -107,4 +115,4 @@ namespace Microsoft.DotNet.Tools.Pack return cmd.Execute(args); } } -} \ No newline at end of file +}