Skip to content

Commit 35066e5

Browse files
authored
[release/10.0.1xx] Fix dnx --help and tool commands to use valid .NET tool examples (#51042)
2 parents 5b52129 + 3b917c6 commit 35066e5

19 files changed

+45
-34
lines changed

.github/copilot-instructions.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Testing:
1616
- Examples:
1717
- `dotnet test test/dotnet.Tests/dotnet.Tests.csproj --filter "Name~ItShowsTheAppropriateMessageToTheUser"`
1818
- `dotnet exec artifacts/bin/redist/Debug/dotnet.Tests.dll -method "*ItShowsTheAppropriateMessageToTheUser*"`
19+
- To test CLI command changes:
20+
- Build the redist SDK: `./build.sh` from repo root
21+
- Create a dogfood environment: `source eng/dogfood.sh`
22+
- Test commands in the dogfood shell (e.g., `dnx --help`, `dotnet tool install --help`)
23+
- The dogfood script sets up PATH and environment to use the newly built SDK
1924

2025
Output Considerations:
2126
- When considering how output should look, solicit advice from baronfel.

src/Cli/dotnet/CliStrings.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ The default is 'false.' However, when targeting .NET 7 or lower, the default is
817817
<comment>{Locked="dotnet workload update"}</comment>
818818
</data>
819819
<data name="PackageIdentityArgumentDescription" xml:space="preserve">
820-
<value>Package reference in the form of a package identifier like 'Newtonsoft.Json' or package identifier and version separated by '@' like '[email protected]'.</value>
820+
<value>Package reference in the form of a package identifier like '{0}' or package identifier and version separated by '@' like '{0}@{1}'.</value>
821821
</data>
822822
<data name="PackageIdentityArgumentIdOrVersionIsNull" xml:space="preserve">
823823
<value>Package reference id and version must not be null.</value>

src/Cli/dotnet/Commands/Tool/Install/ToolInstallCommandParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.DotNet.Cli.Commands.Tool.Install;
1010

1111
internal static class ToolInstallCommandParser
1212
{
13-
public static readonly Argument<PackageIdentityWithRange> PackageIdentityArgument = CommonArguments.RequiredPackageIdentityArgument();
13+
public static readonly Argument<PackageIdentityWithRange> PackageIdentityArgument = CommonArguments.RequiredPackageIdentityArgument("dotnetsay", "2.1.7");
1414

1515
public static readonly Option<string> VersionOption = new("--version")
1616
{

src/Cli/dotnet/Commands/Tool/Update/ToolUpdateCommandParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.DotNet.Cli.Commands.Tool.Update;
99

1010
internal static class ToolUpdateCommandParser
1111
{
12-
public static readonly Argument<PackageIdentityWithRange?> PackageIdentityArgument = CommonArguments.OptionalPackageIdentityArgument();
12+
public static readonly Argument<PackageIdentityWithRange?> PackageIdentityArgument = CommonArguments.OptionalPackageIdentityArgument("dotnetsay", "2.1.7");
1313

1414
public static readonly Option<bool> UpdateAllOption = ToolAppliedOption.UpdateAllOption;
1515

src/Cli/dotnet/CommonArguments.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,23 @@ namespace Microsoft.DotNet.Cli
1212
internal class CommonArguments
1313
{
1414
public static DynamicArgument<PackageIdentityWithRange?> OptionalPackageIdentityArgument() =>
15+
OptionalPackageIdentityArgument("Newtonsoft.Json", "13.0.3");
16+
17+
public static DynamicArgument<PackageIdentityWithRange?> OptionalPackageIdentityArgument(string examplePackage, string exampleVersion) =>
1518
new("packageId")
1619
{
17-
Description = CliStrings.PackageIdentityArgumentDescription,
20+
Description = string.Format(CliStrings.PackageIdentityArgumentDescription, examplePackage, exampleVersion),
1821
CustomParser = (ArgumentResult argumentResult) => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value),
1922
Arity = ArgumentArity.ZeroOrOne,
2023
};
2124

2225
public static DynamicArgument<PackageIdentityWithRange> RequiredPackageIdentityArgument() =>
26+
RequiredPackageIdentityArgument("Newtonsoft.Json", "13.0.3");
27+
28+
public static DynamicArgument<PackageIdentityWithRange> RequiredPackageIdentityArgument(string examplePackage, string exampleVersion) =>
2329
new("packageId")
2430
{
25-
Description = CliStrings.PackageIdentityArgumentDescription,
31+
Description = string.Format(CliStrings.PackageIdentityArgumentDescription, examplePackage, exampleVersion),
2632
CustomParser = (ArgumentResult argumentResult) => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value)!.Value,
2733
Arity = ArgumentArity.ExactlyOne,
2834
};

src/Cli/dotnet/xlf/CliStrings.cs.xlf

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/xlf/CliStrings.de.xlf

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/xlf/CliStrings.es.xlf

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/xlf/CliStrings.fr.xlf

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Cli/dotnet/xlf/CliStrings.it.xlf

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)