Add details command#31743
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
|
@vlada-shubina, please take a look when you come back. |
| <data name="Command_Details_Description" xml:space="preserve"> | ||
| <value> | ||
| Provides details for specified Nuget package. | ||
| The command checks if the package is installed locally, if it wasn't found, then it searches on the https://www.nuget.org/.</value> |
There was a problem hiding this comment.
Does this respect Package Source Mapping, or does this just always use https://www.nuget.org/?
There was a problem hiding this comment.
@maridematte/ @YuliiaKovalova for details we should be able to use any configured NuGet source, right? This doesn't require non-NuGet-API metadata like search does.
Separately, @KalleOlaviNiemitalo I'm not sure if the NuGet API exposes PSM data or if it's all implementation details. @YuliiaKovalova can you check with that team?
|
Feedback to it: |
OK, I suppose that is better than https://licenses.nuget.org/MIT, as spdx.org also hosts licenses like |
|
@KalleOlaviNiemitalo that's actually a great point - since NuGet.org is our source of truth here, we should use licenses.nuget.org instead of spdx. Have to bias towards consistency here. |
|
For accessibility, the text from the image in #31743 (comment): |
|
https://github.com/NuGet/Home/wiki/Packaging-License-within-the-nupkg-(Technical-Spec)#approach-for-in-house-packages-%2D-unlicensed suggests |
|
Here is my sketched up feedback for the display output - note the # are comments on each line of output: PS C:\ykovalova_sdk\yk_fork_8\sdk> dotnet new details NUnit3.DotNetNew.Template --version "1.0.0"
NUnit3.DotNetNew.Template
Details: Project and item templates containing basic NUnit 3 Test Project.
Authors: Aleksei Kharlov
Owners: akharlov, rprouse # each of these should link to the owners page on nuget.org (e.g. https://www.nuget.org/profiles/akharlov)
License Metadata: # depending on how the license is provided in the package, this should change
License Url: https://github.com/halex2005/dotnet-new-nunit/blob/master/LICENSE # clickable link
License Expression: MIT # link to licenses.nuget.org/MIT per https://learn.microsoft.com/en-us/nuget/nuget-org/licenses.nuget.org#request
Repository Url: https://github.com/halex2005/dotnet-new-nunit # clickable link
Templates:
NUnit 3 Test Project
Short Names: nunit
Author: Aleksei Kharlov aka halex2005 (codeofclimber.ru)
Tags: Test/NUnit # tags should be split on '/' and each tag should be a clickable link to the NuGet.org query for that tag: https://www.nuget.org/packages?q=Tags%3A%22Test%22
Languages: C#, F#, VB # group the languages available for each template
Details: A project that contains NUnit tests that can run on .NET Core on Windows, Linux and macOS
NUnit 3 Test Item
Short Names: nunit-test
Author: Aleksei Kharlov aka halex2005 (codeofclimber.ru)
Tags: Test/NUnit
Languages: C#, F#, VB
Details: A item that contains NUnit tests |
Windows Terminal already recognizes URLs in the output and makes them clickable, without needing .NET SDK to mark them specially. |
|
@KalleOlaviNiemitalo yes, all feedback about clickable links is predicated on the terminal supporting control codes to signal that. This is a muscle that the CLI and MSBuild are learning this release cycle and we're fairly confident it in - though of course there should always be an explicit opt out. |
|
If a package has an embedded license file, how will the command display that? |
|
Might just have to be a file:// URI to the nuspec and let it open with whatever file handler the users system has configured for nuspec files. |
|
This is the text from the above image: |
|
I like this a lot @maridematte. Will we be able to make those URLs clickable? That's the only major usability feature I see missing. Happy to see this getting close! |
|
The urls are clickable currently, if you're using windows terminal you can press |
|
Looks good to me! |
|
@maridematte, I would recommend adding in output 3 more fields: Version, Source Feed, and Prefix Reserved flag. |
|
Tests: i would recommend to cover at least the following scenarios
|
baronfel
left a comment
There was a problem hiding this comment.
There are a few notes about localization of user-facing strings and a couple layout notes that we spoke about offline as well. Overall I like the state of this a lot!
| private IEnumerable<PackageSource> LoadNuGetSources(IEnumerable<string>? additionalSources, bool includeNuGetFeed) | ||
| { | ||
| IEnumerable<PackageSource> defaultSources; | ||
| string currentDirectory = string.Empty; | ||
| try | ||
| { | ||
| currentDirectory = Directory.GetCurrentDirectory(); | ||
| ISettings settings = global::NuGet.Configuration.Settings.LoadDefaultSettings(currentDirectory); | ||
| PackageSourceProvider packageSourceProvider = new PackageSourceProvider(settings); | ||
| defaultSources = packageSourceProvider.LoadPackageSources().Where(source => source.IsEnabled); | ||
| if (includeNuGetFeed) | ||
| { | ||
| var nuGetFeed = new PackageSource(NugetOrgFeed); | ||
| defaultSources = defaultSources.Append(nuGetFeed); | ||
| } | ||
| } |
There was a problem hiding this comment.
Future expansion: I think if string packageIdentity was added to this method, then we could pretty easily add support for PackageSourceMapping to this feature via something like this:
PackageSourceMapping packageSourceMapping = PackageSourceMapping.GetPackageSourceMapping(settings);
IReadOnlyList<string> validPackageSources = packageSourceMapping.GetConfiguredPackageSources(packageIdentity);
defaultSources = packageSourceProvider.LoadPackageSources().Where(source => source.IsEnabled && (validPackageSources?.Contains(source.Name) ?? true));We should consider PSM support all-up for templating, though.
2385aa9 to
ee0a4e4
Compare
|
[celebrate] Yuliia Kovalova reacted to your message:
…________________________________
From: Mariana Dematte ***@***.***>
Sent: Wednesday, June 28, 2023 4:58:02 PM
To: dotnet/sdk ***@***.***>
Cc: Yuliia Kovalova ***@***.***>; Mention ***@***.***>
Subject: Re: [dotnet/sdk] Add details command (PR #31743)
Merged #31743<#31743> into main.
—
Reply to this email directly, view it on GitHub<#31743 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AWYM53UASIZI3JPOVJV6WITXNRPBVANCNFSM6AAAAAAW3THVKA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|



Implements the item: dotnet/templating#6683
Add details command to display more information about a template package.