cake icon indicating copy to clipboard operation
cake copied to clipboard

Add DotNetListPackage alias for dotnet list package command

Open Marusyk opened this issue 2 years ago • 9 comments

Add an alias for dotnet list package command

Fixes #4224

Here is the basic implementation. I need your suggestion on what we should do with the output. If the format is console we will receive smth like this image

  • hard to parse into model. If the format is json, there could be a several different output which is dependent on the input params image image when error image

If we allow only JSON, then I'll be able to create models and deserialize (for console format it is almost impossible) and return the result for public ListResult DotNetListPackage(...) but what if someone just wants to get the output and that's all. What do you think?

Thank you in advance

Marusyk avatar Oct 11 '23 22:10 Marusyk

@Marusyk going the JSON route seems like the best option and an object model provides the most value in a Cake context.

devlead avatar Oct 30 '23 07:10 devlead

ok, so should we allow only --format json and have the alias like public ListPackage List(Project, Settings)?

Marusyk avatar Oct 30 '23 10:10 Marusyk

ok, so should we allow only --format json and have the alias like public ListPackage List(Project, Settings)?

Yes, think that makes sense.

devlead avatar Oct 30 '23 11:10 devlead

Can someone help me find the model for that json result? Didn't find anything here: https://github.com/dotnet/sdk/tree/main/src/Cli/dotnet/commands/dotnet-list/dotnet-list-package

Depending on the parameters, the result is different every time. I would like to know all the possible attributes that can be returned and make a model for them.

Currently, I started with image

Marusyk avatar Nov 11 '23 23:11 Marusyk

Thin it's just a wrapper around NuGet.CommandLine.XPlat which probably means the code is somewhere around here

https://github.com/NuGet/NuGet.Client/tree/dev/src/NuGet.Core/NuGet.CommandLine.XPlat/ListPackage

devlead avatar Nov 12 '23 06:11 devlead

Useful: https://github.com/NuGet/Home/blob/dev/accepted/2022/DotnetListPackageMachineReadableJsonOutput.md It's not quite written in a schema way, but it contains all the examples.

Marusyk avatar Dec 03 '23 01:12 Marusyk

Thanks @Marusyk looking good so far. Some tests are failing. Ping when ready for next round

augustoproiete avatar Dec 08 '23 17:12 augustoproiete

thanks @augustoproiete . can you help me? I can't figure out why the tests are failing

Marusyk avatar Dec 09 '23 20:12 Marusyk

can anyone help me to fix this PR?)

Marusyk avatar Jan 31 '24 23:01 Marusyk