microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.3k stars 1.45k forks source link

JSON Formatted Output Support #184

Open RichiCoder1 opened 4 years ago

RichiCoder1 commented 4 years ago

Description of the new feature/enhancement

To enable automation and consumption via other tools, it'd be great if current and future commands supported a JSON output mode.

mikemaccana commented 4 years ago

Modern Windows command line apps are in powershell, and already output structured objects. These can already be converted to JSON, Excel, CSV, or whatever other format is preferred.

The issue is that winget is unique, in that it doesn't output any structured data. #196 was created to address this issue but it was closed.

RichiCoder1 commented 4 years ago

@mikemaccana As mentioned on the other two issues, PowerShell isn't available in all Windows SKUs which this is targeting. For native PowerShell support, you're looking for https://github.com/microsoft/winget-cli/issues/221.

megamorf commented 4 years ago

@RichiCoder1 Could you list all target SKUs and/or a link to the requirements spec, please?

RichiCoder1 commented 4 years ago

It's been mentioned multiple times across multiple sources:

denelon commented 3 years ago

@RichiCoder1 I'm going through the backlog as a part of our planning exercise for the next few milestones. I'm going to close this as a Duplicate of #221.

ghost commented 3 years ago

@RichiCoder1 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.

RichiCoder1 commented 3 years ago

I'm cool with that as long as the ultimate functionality is still flexible enough to be consumed from other tools

denelon commented 3 years ago

Yes, that is the intent. Rather than building some kind of --output-JSON flag, the native PowerShell implementation will provide objects that may be used, and will not have the truncated output string behavior currently exhibited in the winget.exe client.

mikemaccana commented 3 years ago

Woo native powershell implementation! That’s exactly what I personally wanted.

stknohg commented 3 years ago

@denelon PowerShell isn't the only Windows shell. For example, I also use nushell, some users use git bash, and some users still use the command prompt.

I strongly hope to implement the json output parameter (like --output-JSON).

mikemaccana commented 3 years ago

You can turn output from any powershell command into JSON by piping to convertto-JSON

stknohg commented 3 years ago

I think It feels very wasteful to call powershel.exe or pwsh.exe every time I use winget on non-PowerShell shell.

denelon commented 7 months ago

I'm going to re-open this issue. It's not high-priority (unless we see a lot of πŸ‘) since we have the option in PowerShell, but I can see value in what is being asked for.

We still have more work to completely move everything the CLI is calling into the COM APIs, and once that's done, providing some kind of output type/format "should" be a bit easier to implement.

Banthaf0dder commented 7 months ago

I'm going to re-open this issue. It's not high-priority (unless we see a lot of πŸ‘) since we have the option in PowerShell, but I can see value in what is being asked for.

We still have more work to completely move everything the CLI is calling into the COM APIs, and once that's done, providing some kind of output type/format "should" be a bit easier to implement.

I'd like to note one thing in reference to powershell. Until the winget powershell module can be used in system context there is a gap in functionality that could be filled if winget output could be json formatted. That would make converting winget output to a powershell object very easy.