cake-build / cake

:cake: Cake (C# Make) is a cross platform build automation system.
https://cakebuild.net
MIT License
3.84k stars 722 forks source link

Add DotNetListPackage alias for dotnet list package command #4229

Open Marusyk opened 9 months ago

Marusyk commented 9 months ago

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

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

devlead commented 8 months ago

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

Marusyk commented 8 months ago

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

devlead commented 8 months ago

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

Yes, think that makes sense.

Marusyk commented 7 months ago

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

devlead commented 7 months ago

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

Marusyk commented 7 months ago

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.

augustoproiete commented 7 months ago

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

Marusyk commented 7 months ago

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

Marusyk commented 5 months ago

can anyone help me to fix this PR?)