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 -o/--output-format options for search/show/list to output CSV|JSON and possibly other formats easy to consume by PowerShell #2595

Closed
rkeithhill-keysight opened this issue Oct 13, 2022 · 3 comments
Labels
Issue-Feature This is a feature request for the Windows Package Manager client. Resolution-Duplicate Issue is a duplicate
Milestone

Comments

@rkeithhill-keysight
Copy link

rkeithhill-keysight commented Oct 13, 2022

Description of the new feature / enhancement

Right now it is really hard to convert the output of commands like winget list in PowerShell. Simply trying to sort the output gives corrupted characters in the output e.g.

$pkgs = winget list
$pkgs

Results in:

image

Even if the corrupted chars were fixed, there is rich data in the output that has to be parsed out by PowerShell - what Jeffrey Snover would call "prayer-based parsing". There is a better way that would benefit not just PowerShell.

Related to #221

Proposed technical implementation details

Implement a new parameter to commands that output rich information e.g. search, show and list (and maybe others). I propose using -o | --output-format. The default output format would be Table, to match the current output format. But I would like to see a CSV option that could be used to open the output in Excel or used by PowerShell like so:

winget list -o csv | ConvertFrom-Csv | Where-Object Name -match Microsft | Sort-Object Name

Furthermore, you could also support a List format that would not truncate text e.g.:

winget list -o list

Name:      JetBrains ETW Host Service (x64) 
Id:        JetBrains.ReSharper
Version:   < 2022.2.2
Available: 2022.2.3
Source:    winget

Name: ...
....
@rkeithhill-keysight rkeithhill-keysight added the Issue-Feature This is a feature request for the Windows Package Manager client. label Oct 13, 2022
@ghost ghost added the Needs-Triage Issue need to be triaged label Oct 13, 2022
@rkeithhill-keysight
Copy link
Author

BTW there is a native PowerShell format called CLIXML that winget could also output but I'm not sure how widely CLIXML was adopted/used.

@Trenly
Copy link
Contributor

Trenly commented Oct 13, 2022

Duplicate of #1753

@ghost
Copy link

ghost commented Oct 13, 2022

@rkeithhill-keysight we've identified this Issue as a duplicate of another one that already exists. This specific instance is being closed in favor of tracking the concern over on the referenced Issue. Thanks for your report! Be sure to add your 👍 to the other issue to help raise the priority.

@ghost ghost closed this as completed Oct 13, 2022
@ghost ghost added Resolution-Duplicate Issue is a duplicate and removed Needs-Triage Issue need to be triaged labels Oct 13, 2022
@denelon denelon added this to the v1.4-Client milestone Nov 22, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature This is a feature request for the Windows Package Manager client. Resolution-Duplicate Issue is a duplicate
Projects
None yet
Development

No branches or pull requests

3 participants