Fixes a few inconsistencies in the display for the dotnet restore -help command.

Fixing tests based on the new strings.
This commit is contained in:
Livar Cunha 2017-05-09 21:05:09 -07:00
parent bbf235e333
commit 477f0f42d0
10 changed files with 28 additions and 26 deletions

View file

@ -101,13 +101,13 @@ namespace Microsoft.DotNet.Tools
public const string MoreThanOneProjectInDirectory = "Found more than one project in `{0}`. Please specify which one to use."; public const string MoreThanOneProjectInDirectory = "Found more than one project in `{0}`. Please specify which one to use.";
public const string FoundInvalidProject = "Found a project `{0}` but it is invalid."; public const string FoundInvalidProject = "Found a project `{0}` but it is invalid.";
public const string InvalidProject = "Invalid project `{0}`."; public const string InvalidProject = "Invalid project `{0}`.";
public const string InvalidProjectWithExceptionMessage = "Invalid project `{0}`. {1}"; public const string InvalidProjectWithExceptionMessage = "Invalid project `{0}`. {1}.";
/// Solution /// Solution
public const string CouldNotFindSolutionIn = "Specified solution file {0} does not exist, or there is no solution file in the directory."; public const string CouldNotFindSolutionIn = "Specified solution file {0} does not exist, or there is no solution file in the directory.";
public const string CouldNotFindSolutionOrDirectory = "Could not find solution or directory `{0}`."; public const string CouldNotFindSolutionOrDirectory = "Could not find solution or directory `{0}`.";
public const string MoreThanOneSolutionInDirectory = "Found more than one solution file in {0}. Please specify which one to use."; public const string MoreThanOneSolutionInDirectory = "Found more than one solution file in {0}. Please specify which one to use.";
public const string InvalidSolutionFormatString = "Invalid solution `{0}`. {1}"; // {0} is the solution path, {1} is already localized details on the failure public const string InvalidSolutionFormatString = "Invalid solution `{0}`. {1}."; // {0} is the solution path, {1} is already localized details on the failure
public const string SolutionDoesNotExist = "Specified solution file {0} does not exist, or there is no solution file in the directory."; public const string SolutionDoesNotExist = "Specified solution file {0} does not exist, or there is no solution file in the directory.";
/// add p2p /// add p2p
@ -185,13 +185,15 @@ namespace Microsoft.DotNet.Tools
public const string ProjectNotCompatibleWithFrameworks = "Project `{0}` cannot be added due to incompatible targeted frameworks between the two projects. Please review the project you are trying to add and verify that is compatible with the following targets:"; public const string ProjectNotCompatibleWithFrameworks = "Project `{0}` cannot be added due to incompatible targeted frameworks between the two projects. Please review the project you are trying to add and verify that is compatible with the following targets:";
public const string ProjectDoesNotTargetFramework = "Project `{0}` does not target framework `{1}`."; public const string ProjectDoesNotTargetFramework = "Project `{0}` does not target framework `{1}`.";
public const string ProjectCouldNotBeEvaluated = "Project `{0}` could not be evaluated. Evaluation failed with following error:\n{1}"; public const string ProjectCouldNotBeEvaluated = "Project `{0}` could not be evaluated. Evaluation failed with following error:\n{1}.";
/// common options /// common options
public const string VerbosityOptionDescription = "Set the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]"; public const string VerbosityOptionDescription = "Set the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].";
public const string FrameworkOptionDescription = "Target framework to publish for. The target framework has to be specified in the project file."; public const string FrameworkOptionDescription = "Target framework to publish for. The target framework has to be specified in the project file.";
public const string RuntimeOptionDescription = "Publish the project for a given runtime. This is used when creating self-contained deployment. Default is to publish a framework-dependent app."; public const string RuntimeOptionDescription = "Publish the project for a given runtime. This is used when creating self-contained deployment. Default is to publish a framework-dependent app.";
public const string ConfigurationOptionDescription = "Configuration to use for building the project. Default for most projects is \"Debug\"."; public const string ConfigurationOptionDescription = "Configuration to use for building the project. Default for most projects is \"Debug\".";
public const string CmdVersionSuffixDescription = "Defines the value for the $(VersionSuffix) property in the project."; public const string CmdVersionSuffixDescription = "Defines the value for the $(VersionSuffix) property in the project.";
public const string ShowHelpDescription = "Show help information.";
} }
} }

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli
public static Option HelpOption() => public static Option HelpOption() =>
Create.Option( Create.Option(
"-h|--help", "-h|--help",
"Show help information", CommonLocalizableStrings.ShowHelpDescription,
Accept.NoArguments(), Accept.NoArguments(),
materialize: o => o.Option.Command().HelpView()); materialize: o => o.Option.Command().HelpView());

View file

@ -35,6 +35,6 @@ namespace Microsoft.DotNet.Tools.Restore
public const string CmdIgnoreFailedSourcesOptionDescription = "Treat package source failures as warnings."; public const string CmdIgnoreFailedSourcesOptionDescription = "Treat package source failures as warnings.";
public const string CmdNoDependenciesOptionDescription = "Set this flag to ignore project to project references and only restore the root project"; public const string CmdNoDependenciesOptionDescription = "Set this flag to ignore project to project references and only restore the root project.";
} }
} }

View file

@ -23,7 +23,7 @@ Arguments:
<args> Project to project references to add <args> Project to project references to add
Options: Options:
-h, --help Show help information -h, --help Show help information.
-f, --framework <FRAMEWORK> Add reference only when targeting a specific framework -f, --framework <FRAMEWORK> Add reference only when targeting a specific framework
"; ";
@ -35,7 +35,7 @@ Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. <PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
package <PACKAGE_NAME> .NET Add Package reference Command package <PACKAGE_NAME> .NET Add Package reference Command

View file

@ -21,7 +21,7 @@ Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. <PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
"; ";
private const string ListCommandHelpText = @".NET List Command private const string ListCommandHelpText = @".NET List Command
@ -32,7 +32,7 @@ Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. <PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
reference .NET Core Project-to-Project dependency viewer reference .NET Core Project-to-Project dependency viewer

View file

@ -20,7 +20,7 @@ Arguments:
<PACKAGE_NAME> Package reference to remove. <PACKAGE_NAME> Package reference to remove.
Options: Options:
-h, --help Show help information -h, --help Show help information.
"; ";
private const string RemoveCommandHelpText = @".NET Remove Command private const string RemoveCommandHelpText = @".NET Remove Command
@ -31,7 +31,7 @@ Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. <PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
package <PACKAGE_NAME> .NET Remove Package reference Command. package <PACKAGE_NAME> .NET Remove Package reference Command.

View file

@ -22,7 +22,7 @@ Arguments:
<args> Project to project references to remove <args> Project to project references to remove
Options: Options:
-h, --help Show help information -h, --help Show help information.
-f, --framework <FRAMEWORK> Remove reference only when targeting a specific framework -f, --framework <FRAMEWORK> Remove reference only when targeting a specific framework
"; ";
@ -34,7 +34,7 @@ Arguments:
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one. <PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
package <PACKAGE_NAME> .NET Remove Package reference Command. package <PACKAGE_NAME> .NET Remove Package reference Command.

View file

@ -24,7 +24,7 @@ Arguments:
<args> Add one or more specified projects to the solution. <args> Add one or more specified projects to the solution.
Options: Options:
-h, --help Show help information -h, --help Show help information.
"; ";
private const string SlnCommandHelpText = @".NET modify solution file command private const string SlnCommandHelpText = @".NET modify solution file command
@ -35,7 +35,7 @@ Arguments:
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one. <SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
add <args> .NET Add project(s) to a solution file Command add <args> .NET Add project(s) to a solution file Command
@ -252,7 +252,7 @@ EndGlobal
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"sln InvalidSolution.sln add {projectToAdd}"); .ExecuteWithCapturedOutput($"sln InvalidSolution.sln add {projectToAdd}");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing"); cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }
@ -272,7 +272,7 @@ EndGlobal
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"sln add {projectToAdd}"); .ExecuteWithCapturedOutput($"sln add {projectToAdd}");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing"); cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }

View file

@ -21,7 +21,7 @@ Arguments:
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one. <SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
"; ";
private const string SlnCommandHelpText = @".NET modify solution file command private const string SlnCommandHelpText = @".NET modify solution file command
@ -32,7 +32,7 @@ Arguments:
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one. <SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
add <args> .NET Add project(s) to a solution file Command add <args> .NET Add project(s) to a solution file Command
@ -101,7 +101,7 @@ Commands:
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("sln InvalidSolution.sln list"); .ExecuteWithCapturedOutput("sln InvalidSolution.sln list");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing"); cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }
@ -120,7 +120,7 @@ Commands:
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput("sln list"); .ExecuteWithCapturedOutput("sln list");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be($"Invalid solution `{solutionFullPath}`. Invalid format in line 1: File header is missing"); cmd.StdErr.Should().Be($"Invalid solution `{solutionFullPath}`. Invalid format in line 1: File header is missing.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }

View file

@ -22,7 +22,7 @@ Arguments:
<args> Remove the specified project(s) from the solution. The project is not impacted. <args> Remove the specified project(s) from the solution. The project is not impacted.
Options: Options:
-h, --help Show help information -h, --help Show help information.
"; ";
private const string SlnCommandHelpText = @".NET modify solution file command private const string SlnCommandHelpText = @".NET modify solution file command
@ -33,7 +33,7 @@ Arguments:
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one. <SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
Options: Options:
-h, --help Show help information -h, --help Show help information.
Commands: Commands:
add <args> .NET Add project(s) to a solution file Command add <args> .NET Add project(s) to a solution file Command
@ -236,7 +236,7 @@ EndGlobal
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"sln InvalidSolution.sln remove {projectToRemove}"); .ExecuteWithCapturedOutput($"sln InvalidSolution.sln remove {projectToRemove}");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing"); cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }
@ -256,7 +256,7 @@ EndGlobal
.WithWorkingDirectory(projectDirectory) .WithWorkingDirectory(projectDirectory)
.ExecuteWithCapturedOutput($"sln remove {projectToRemove}"); .ExecuteWithCapturedOutput($"sln remove {projectToRemove}");
cmd.Should().Fail(); cmd.Should().Fail();
cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing"); cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing.");
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText); cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
} }