-
Notifications
You must be signed in to change notification settings - Fork 689
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
nuget sources
: move implementation into NuGet.Commands.dll - refactor into SourcesArgs/SourcesRunner - move enums/strings
#3112
Conversation
nuget sources
: move implementation into NuGet.Commands.dll - refactor into SourcesArgs/SourcesRunner - move enums/strings
@@ -3047,474 +2990,6 @@ To prevent NuGet from downloading packages during build, open the Visual Studio | |||
<data name="InstallCommandPackageAlreadyExists_cht" xml:space="preserve"> | |||
<value>已安裝封裝 "{0}"。</value> | |||
</data> | |||
<data name="SourcesCommandNoSources_csy" xml:space="preserve"> |
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.
Need to think through the localization impact of this string table change.
Moved the english strings into nuget.commands.dll, but deleted the localized strings in nuget.exe -- and was hoping standard localization would work. But NuGet.exe may be a different beast for loc.
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.
Some changes needed, mostly cleanup right now.
src/NuGet.Core/NuGet.Commands/NuGet.CommandLine/SourcesListFormat.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.Commands/NuGet.CommandLine/SourcesListFormat.cs
Outdated
Show resolved
Hide resolved
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.
I like the improvements in the code, but want to make sure the throws
becoming LogError
s is as expected. Assuming the spirit of this change is to show more validation errors to the user at once, rather than making them fix missing arguments 1 by 1.
@@ -5550,4 +5550,7 @@ nuget trusted-signers Remove -Name TrustedRepo</value> | |||
<data name="PackageCommandDeterministic" xml:space="preserve"> | |||
<value>Specify if the command should create a deterministic package. Multiple invocations of the pack command will create the exact same package.</value> | |||
</data> | |||
<data name="SourcesActionInvalid" xml:space="preserve"> | |||
<value>nuget sources</value> |
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.
this was likely a placeholder.
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.
Looks like we're back to a throw-on-error model, so looks good.
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.
Looks good overall.
Some concern with the exception move. It feels like a leak.
{ | ||
if (string.IsNullOrEmpty(args.Name)) | ||
{ | ||
throw new CommandLineException(Strings.SourcesCommandNameRequired); |
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.
Why not use ArgumentException?
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.
Discussed offline.
Whether we call this CommandLineException or something smarter like LocalizedException can be decided in the dotnet.exe side implementation of this.
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.
fwiw, looking into our code...there's nothing that relies on this being a commandlineexception.
STarted another PR to covert this work. Got checked into 5.5 recently. Closing this PR. |
Bug
Fixes: NuGet/Home#4126 (part 1 or 2 to support for dotnet nuget sources)
Regression: No
Fix
Details: This set of work has reorganized the code from a monolithic SourcesCommand in NuGet.CommandLine to a SourcesCommand which creates a SourcesArgs and passes it to a SourcesRunner. Args/Runner are in NuGet.Commands.
This should maintain current functionality in "NuGet Sources" while enabling the dotnet nuget sources work to be built on top of the Args/Runner in NuGet.Commands in another PR soon.
Testing/Validation
Tests Added: I fixed a test that was skipped and have it run now, but didn't see need to add any new tests at this stage. Let me know if I am wrong there.
Reason for not adding tests: not changing any functionality, fairly good coverage already.
Validation: ran unit tests