Skip to content
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

Add DotNetListPackage alias for dotnet list package command #4229

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

Marusyk
Copy link
Contributor

@Marusyk Marusyk commented Oct 11, 2023

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

@devlead
Copy link
Member

devlead commented Oct 30, 2023

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

@Marusyk
Copy link
Contributor Author

Marusyk commented Oct 30, 2023

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

@devlead
Copy link
Member

devlead commented Oct 30, 2023

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

Yes, think that makes sense.

@Marusyk
Copy link
Contributor Author

Marusyk commented Nov 11, 2023

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
Copy link
Member

devlead commented Nov 12, 2023

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
Copy link
Contributor Author

Marusyk commented Dec 3, 2023

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
Copy link
Member

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

@Marusyk
Copy link
Contributor Author

Marusyk commented Dec 9, 2023

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

@Marusyk
Copy link
Contributor Author

Marusyk commented Jan 31, 2024

can anyone help me to fix this PR?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DotNetListPackage alias for dotnet list package command
3 participants