Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 477f0f4

Browse files
committed
Fixes a few inconsistencies in the display for the dotnet restore -help command.
Fixing tests based on the new strings.
1 parent bbf235e commit 477f0f4

File tree

10 files changed

+28
-26
lines changed

10 files changed

+28
-26
lines changed

src/dotnet/CommonLocalizableStrings.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ internal class CommonLocalizableStrings
101101
public const string MoreThanOneProjectInDirectory = "Found more than one project in `{0}`. Please specify which one to use.";
102102
public const string FoundInvalidProject = "Found a project `{0}` but it is invalid.";
103103
public const string InvalidProject = "Invalid project `{0}`.";
104-
public const string InvalidProjectWithExceptionMessage = "Invalid project `{0}`. {1}";
104+
public const string InvalidProjectWithExceptionMessage = "Invalid project `{0}`. {1}.";
105105

106106
/// Solution
107107
public const string CouldNotFindSolutionIn = "Specified solution file {0} does not exist, or there is no solution file in the directory.";
108108
public const string CouldNotFindSolutionOrDirectory = "Could not find solution or directory `{0}`.";
109109
public const string MoreThanOneSolutionInDirectory = "Found more than one solution file in {0}. Please specify which one to use.";
110-
public const string InvalidSolutionFormatString = "Invalid solution `{0}`. {1}"; // {0} is the solution path, {1} is already localized details on the failure
110+
public const string InvalidSolutionFormatString = "Invalid solution `{0}`. {1}."; // {0} is the solution path, {1} is already localized details on the failure
111111
public const string SolutionDoesNotExist = "Specified solution file {0} does not exist, or there is no solution file in the directory.";
112112

113113
/// add p2p
@@ -185,13 +185,15 @@ internal class CommonLocalizableStrings
185185

186186
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:";
187187
public const string ProjectDoesNotTargetFramework = "Project `{0}` does not target framework `{1}`.";
188-
public const string ProjectCouldNotBeEvaluated = "Project `{0}` could not be evaluated. Evaluation failed with following error:\n{1}";
188+
public const string ProjectCouldNotBeEvaluated = "Project `{0}` could not be evaluated. Evaluation failed with following error:\n{1}.";
189189

190190
/// common options
191-
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]";
191+
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].";
192192
public const string FrameworkOptionDescription = "Target framework to publish for. The target framework has to be specified in the project file.";
193193
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.";
194194
public const string ConfigurationOptionDescription = "Configuration to use for building the project. Default for most projects is \"Debug\".";
195195
public const string CmdVersionSuffixDescription = "Defines the value for the $(VersionSuffix) property in the project.";
196+
197+
public const string ShowHelpDescription = "Show help information.";
196198
}
197199
}

src/dotnet/CommonOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal static class CommonOptions
1212
public static Option HelpOption() =>
1313
Create.Option(
1414
"-h|--help",
15-
"Show help information",
15+
CommonLocalizableStrings.ShowHelpDescription,
1616
Accept.NoArguments(),
1717
materialize: o => o.Option.Command().HelpView());
1818

src/dotnet/commands/dotnet-restore/LocalizableStrings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ internal class LocalizableStrings
3535

3636
public const string CmdIgnoreFailedSourcesOptionDescription = "Treat package source failures as warnings.";
3737

38-
public const string CmdNoDependenciesOptionDescription = "Set this flag to ignore project to project references and only restore the root project";
38+
public const string CmdNoDependenciesOptionDescription = "Set this flag to ignore project to project references and only restore the root project.";
3939
}
4040
}

test/dotnet-add-reference.Tests/GivenDotnetAddReference.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class GivenDotnetAddReference : TestBase
2323
<args> Project to project references to add
2424
2525
Options:
26-
-h, --help Show help information
26+
-h, --help Show help information.
2727
-f, --framework <FRAMEWORK> Add reference only when targeting a specific framework
2828
";
2929

@@ -35,7 +35,7 @@ public class GivenDotnetAddReference : TestBase
3535
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
3636
3737
Options:
38-
-h, --help Show help information
38+
-h, --help Show help information.
3939
4040
Commands:
4141
package <PACKAGE_NAME> .NET Add Package reference Command

test/dotnet-list-reference.Tests/GivenDotnetListReference.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class GivenDotnetListReference : TestBase
2121
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
2222
2323
Options:
24-
-h, --help Show help information
24+
-h, --help Show help information.
2525
";
2626

2727
private const string ListCommandHelpText = @".NET List Command
@@ -32,7 +32,7 @@ public class GivenDotnetListReference : TestBase
3232
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
3333
3434
Options:
35-
-h, --help Show help information
35+
-h, --help Show help information.
3636
3737
Commands:
3838
reference .NET Core Project-to-Project dependency viewer

test/dotnet-remove-package.Tests/GivenDotnetRemovePackage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class GivenDotnetRemovePackage : TestBase
2020
<PACKAGE_NAME> Package reference to remove.
2121
2222
Options:
23-
-h, --help Show help information
23+
-h, --help Show help information.
2424
";
2525

2626
private const string RemoveCommandHelpText = @".NET Remove Command
@@ -31,7 +31,7 @@ public class GivenDotnetRemovePackage : TestBase
3131
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
3232
3333
Options:
34-
-h, --help Show help information
34+
-h, --help Show help information.
3535
3636
Commands:
3737
package <PACKAGE_NAME> .NET Remove Package reference Command.

test/dotnet-remove-reference.Tests/GivenDotnetRemoveP2P.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class GivenDotnetRemoveReference : TestBase
2222
<args> Project to project references to remove
2323
2424
Options:
25-
-h, --help Show help information
25+
-h, --help Show help information.
2626
-f, --framework <FRAMEWORK> Remove reference only when targeting a specific framework
2727
";
2828

@@ -34,7 +34,7 @@ public class GivenDotnetRemoveReference : TestBase
3434
<PROJECT> The project file to operate on. If a file is not specified, the command will search the current directory for one.
3535
3636
Options:
37-
-h, --help Show help information
37+
-h, --help Show help information.
3838
3939
Commands:
4040
package <PACKAGE_NAME> .NET Remove Package reference Command.

test/dotnet-sln-add.Tests/GivenDotnetSlnAdd.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class GivenDotnetSlnAdd : TestBase
2424
<args> Add one or more specified projects to the solution.
2525
2626
Options:
27-
-h, --help Show help information
27+
-h, --help Show help information.
2828
";
2929

3030
private const string SlnCommandHelpText = @".NET modify solution file command
@@ -35,7 +35,7 @@ public class GivenDotnetSlnAdd : TestBase
3535
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
3636
3737
Options:
38-
-h, --help Show help information
38+
-h, --help Show help information.
3939
4040
Commands:
4141
add <args> .NET Add project(s) to a solution file Command
@@ -252,7 +252,7 @@ public void WhenInvalidSolutionIsPassedItPrintsErrorAndUsage()
252252
.WithWorkingDirectory(projectDirectory)
253253
.ExecuteWithCapturedOutput($"sln InvalidSolution.sln add {projectToAdd}");
254254
cmd.Should().Fail();
255-
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing");
255+
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing.");
256256
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
257257
}
258258

@@ -272,7 +272,7 @@ public void WhenInvalidSolutionIsFoundItPrintsErrorAndUsage()
272272
.WithWorkingDirectory(projectDirectory)
273273
.ExecuteWithCapturedOutput($"sln add {projectToAdd}");
274274
cmd.Should().Fail();
275-
cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing");
275+
cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing.");
276276
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
277277
}
278278

test/dotnet-sln-list.Tests/GivenDotnetSlnList.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class GivenDotnetSlnList : TestBase
2121
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
2222
2323
Options:
24-
-h, --help Show help information
24+
-h, --help Show help information.
2525
";
2626

2727
private const string SlnCommandHelpText = @".NET modify solution file command
@@ -32,7 +32,7 @@ public class GivenDotnetSlnList : TestBase
3232
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
3333
3434
Options:
35-
-h, --help Show help information
35+
-h, --help Show help information.
3636
3737
Commands:
3838
add <args> .NET Add project(s) to a solution file Command
@@ -101,7 +101,7 @@ public void WhenInvalidSolutionIsPassedItPrintsErrorAndUsage()
101101
.WithWorkingDirectory(projectDirectory)
102102
.ExecuteWithCapturedOutput("sln InvalidSolution.sln list");
103103
cmd.Should().Fail();
104-
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing");
104+
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing.");
105105
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
106106
}
107107

@@ -120,7 +120,7 @@ public void WhenInvalidSolutionIsFoundItPrintsErrorAndUsage()
120120
.WithWorkingDirectory(projectDirectory)
121121
.ExecuteWithCapturedOutput("sln list");
122122
cmd.Should().Fail();
123-
cmd.StdErr.Should().Be($"Invalid solution `{solutionFullPath}`. Invalid format in line 1: File header is missing");
123+
cmd.StdErr.Should().Be($"Invalid solution `{solutionFullPath}`. Invalid format in line 1: File header is missing.");
124124
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
125125
}
126126

test/dotnet-sln-remove.Tests/GivenDotnetSlnRemove.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class GivenDotnetSlnRemove : TestBase
2222
<args> Remove the specified project(s) from the solution. The project is not impacted.
2323
2424
Options:
25-
-h, --help Show help information
25+
-h, --help Show help information.
2626
";
2727

2828
private const string SlnCommandHelpText = @".NET modify solution file command
@@ -33,7 +33,7 @@ public class GivenDotnetSlnRemove : TestBase
3333
<SLN_FILE> Solution file to operate on. If not specified, the command will search the current directory for one.
3434
3535
Options:
36-
-h, --help Show help information
36+
-h, --help Show help information.
3737
3838
Commands:
3939
add <args> .NET Add project(s) to a solution file Command
@@ -236,7 +236,7 @@ public void WhenInvalidSolutionIsPassedItPrintsErrorAndUsage()
236236
.WithWorkingDirectory(projectDirectory)
237237
.ExecuteWithCapturedOutput($"sln InvalidSolution.sln remove {projectToRemove}");
238238
cmd.Should().Fail();
239-
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing");
239+
cmd.StdErr.Should().Be("Invalid solution `InvalidSolution.sln`. Invalid format in line 1: File header is missing.");
240240
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
241241
}
242242

@@ -256,7 +256,7 @@ public void WhenInvalidSolutionIsFoundItPrintsErrorAndUsage()
256256
.WithWorkingDirectory(projectDirectory)
257257
.ExecuteWithCapturedOutput($"sln remove {projectToRemove}");
258258
cmd.Should().Fail();
259-
cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing");
259+
cmd.StdErr.Should().Be($"Invalid solution `{solutionPath}`. Invalid format in line 1: File header is missing.");
260260
cmd.StdOut.Should().BeVisuallyEquivalentTo(HelpText);
261261
}
262262

0 commit comments

Comments
 (0)