-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix dnx --help and tool commands to use valid .NET tool examples
#51009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ad6b924
7c016c0
fd497be
64be82e
b03b828
bc0f3a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -819,6 +819,9 @@ The default is 'false.' However, when targeting .NET 7 or lower, the default is | |
| <data name="PackageIdentityArgumentDescription" xml:space="preserve"> | ||
| <value>Package reference in the form of a package identifier like 'Newtonsoft.Json' or package identifier and version separated by '@' like '[email protected]'.</value> | ||
| </data> | ||
| <data name="ToolPackageIdentityArgumentDescription" xml:space="preserve"> | ||
| <value>Package reference in the form of a package identifier like 'dotnetsay' or package identifier and version separated by '@' like '[email protected]'.</value> | ||
| </data> | ||
| <data name="PackageIdentityArgumentIdOrVersionIsNull" xml:space="preserve"> | ||
| <value>Package reference id and version must not be null.</value> | ||
| </data> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,14 @@ public static DynamicArgument<PackageIdentityWithRange> RequiredPackageIdentityA | |
| Arity = ArgumentArity.ExactlyOne, | ||
| }; | ||
|
|
||
| public static DynamicArgument<PackageIdentityWithRange> RequiredToolPackageIdentityArgument() => | ||
| new("packageId") | ||
| { | ||
| Description = CliStrings.ToolPackageIdentityArgumentDescription, | ||
| CustomParser = (ArgumentResult argumentResult) => ParsePackageIdentityWithVersionSeparator(argumentResult.Tokens[0]?.Value)!.Value, | ||
| Arity = ArgumentArity.ExactlyOne, | ||
| }; | ||
|
|
||
|
||
| private static PackageIdentityWithRange? ParsePackageIdentityWithVersionSeparator(string? packageIdentity, char versionSeparator = '@') | ||
| { | ||
| if (string.IsNullOrEmpty(packageIdentity)) | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot I'm going to nitpick once again. Instead of separate Description strings for tool packages and non-tool-packages, make a single format string with placeholders for a package id and version, and then update the callsites to use the templated format string, passing in the existing/appropriate package id and version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored to use a single format string with placeholders as suggested. Changes in bc0f3a2:
PackageIdentityArgumentDescriptionusing{0}and{1}placeholdersexamplePackageandexampleVersionparameters"dotnetsay", "2.1.7""Newtonsoft.Json", "13.0.3"(default)string.Format()to populate placeholdersThis eliminates the duplicate resource string while maintaining clean separation between contexts through parameterization.