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 option for specifying the version of machine-readable output of dotnet list package command #29367

Conversation

erdembayar
Copy link
Contributor

@erdembayar erdembayar commented Dec 2, 2022

Related to: NuGet/NuGet.Client#4855
Add new --output-version option for machine readable output of dotnet list package command. I forgot to include in #29017
It would be used like below:
dotnet list package --format json --output-version 1

@@ -63,6 +63,9 @@ internal static class ListPackageReferencesCommandParser
public static readonly Option FormatOption = new ForwardedOption<ReportOutputFormat>("--format", LocalizableStrings.CmdFormatDescription)
{ }.ForwardAsSingle(o => $"--format:{o}");

public static readonly Option OutputVersiontOption = new ForwardedOption<int>("--output-version", LocalizableStrings.CmdOutputVersionDescription)
Copy link
Contributor Author

@erdembayar erdembayar Dec 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baronfel
It's currently just 1 or nothing option. I found it's bit challenging to add 1 as enum without changing other codes on how enum is parsed. So, I'm just using int here.

@@ -171,4 +171,7 @@
<data name="CmdFormatDescription" xml:space="preserve">
<value>Specifies the output format type for the list packages command.</value>
</data>
<data name="CmdOutputVersionDescription" xml:space="preserve">
<value>Specifies the output version for the machine readable list packages command output.</value>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. From the title of the PR, I initially thought this option makes the output include the versions of the referenced packages, and wondered why they wouldn't be included by default.
  2. Is it necessary to mention "list packages command" in the option descriptions? I'd expect these descriptions to be displayed only when the user already specified that command.

I'd prefer something like "Specifies the version of machine-readable output", to make it clear that this doesn't refer to versions of packages. Perhaps also mention that this is for --format=json.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I addressed your concerns, please check.

@erdembayar erdembayar changed the title Add version output option for dotnet list package command Specifies the version of machine-readable output (dotnet list package command --format json) Dec 6, 2022
@erdembayar erdembayar changed the title Specifies the version of machine-readable output (dotnet list package command --format json) Specifies the version of machine-readable output (dotnet list package command) Dec 6, 2022
@erdembayar erdembayar changed the title Specifies the version of machine-readable output (dotnet list package command) Specifies the version of machine-readable output of dotnet list package command Dec 6, 2022
@erdembayar erdembayar changed the title Specifies the version of machine-readable output of dotnet list package command Add option for specifying the version of machine-readable output of dotnet list package command Dec 6, 2022
erdembayar and others added 2 commits December 6, 2022 13:20
…ckageReferencesCommandParser.cs

Co-authored-by: Daniel Plaisted <daplaist@microsoft.com>
@@ -171,4 +171,7 @@
<data name="CmdFormatDescription" xml:space="preserve">
<value>Specifies the output format type for the list packages command.</value>
</data>
<data name="CmdOutputVersionDescription" xml:space="preserve">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dominoFire @nkolev92 @JonDouglas
Does wording look ok for you?

Copy link

@dominoFire dominoFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment on string resources. Thank you!

Copy link

@dominoFire dominoFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signing-off.

@erdembayar erdembayar merged commit 8758078 into release/7.0.2xx Dec 7, 2022
@erdembayar erdembayar deleted the dev-eryondon-dotnetlistpackage-outputversion-option branch December 7, 2022 16:31
@erdembayar
Copy link
Contributor Author

@dsplaisted
Does this commit automatically flow to main branch or do I need cherry pick to main branch?

@dsplaisted
Copy link
Member

Does this commit automatically flow to main branch or do I need cherry pick to main branch?

It will flow to main eventually. Once this PR is merged then there should be another one generated which will include these changes.

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.

6 participants