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

Feature Request: Enable Command Chaining for "winget show" and "winget install" #5046

Open
davidldennison opened this issue Dec 7, 2024 · 5 comments
Assignees
Labels
Issue-Docs It's a documentation issue that really should be on MicrosoftDocs

Comments

@davidldennison
Copy link

Description of the new feature / enhancement

Description:

I’d like to propose an enhancement to the Winget-CLI to support command chaining, particularly for winget show and winget install. I'm not exactly sure about the technical limitations of such a feature, but it's something I wished was a feature for quite a while now!

Currently, if you want to query or install multiple packages, you need to run separate commands for each package, which can quickly become tedious—especially when exploring for new tools, checking download locations, or checking versions for example. By enabling chaining, Winget could take a significant step toward improving the user experience for both new and experienced users, aligning more in terms of functionality set by package managers like Homebrew and apt-get.

This feature would allow users to execute commands like the following:

winget show GitHub.cli GitHub.GitHubDesktop GitTools.GitVersion StefHeyenrath.GitHubReleaseNotes

This would display information about all specified packages in one output, saving users from having to run separate commands for each package.

Image

Similarly, chaining could also extend to winget install:

winget install GitHub.cli GitHub.GitHubDesktop GitTools.GitVersion StefHeyenrath.GitHubReleaseNotes

This would install multiple applications in a single command.

Benefits of Adding winget show Chaining

Improved Package Discovery:

Many package names may not be self-explanatory. For instance, a user might not know whether GitTools.GitVersion is related to git, GitHub, or both. By chaining winget show, users can query multiple packages in a single command to better understand what they are installing.

Streamlined User Experience:

Reduces the need for repetitive commands when researching packages or confirming package details before installation.
Combines efficiency with clarity, making winget a more effective tool for package management.
Ideal for New and Advanced Users Alike:

New Users: Helps users transitioning to Windows from macOS and Linux package managers understand packages faster.

Advanced Users: Enables faster workflows by combining queries into a single command.
Pre-installation Transparency:

Users can see descriptions, version details, and dependencies for multiple packages at once, reducing errors and improving confidence in installations.

Extending Command Chaining to winget install

While the winget show chaining is the primary focus of this request, adding similar functionality for winget install would also:

- Simplify Onboarding: Users setting up a new machine could install multiple applications with one command, saving time.
- Boost Adoption from macOS and Linux Users: Homebrew and Linux package managers like apt-get allow similar functionality, making Windows more attractive to cross-platform developers.
- Support for Automation: Chaining reduces complexity in batch scripts and automation pipelines, benefiting developers and IT professionals alike.

Why This Matters

With the rise of AI development and the need for cross-platform tools, Microsoft has an opportunity to attract macOS and Linux users to Windows. Features like this improve usability and align with what developers expect from modern package managers, ensuring Windows remains competitive as a development platform.

Proposed technical implementation details

Implementation Suggestion

  • Allow winget show to accept multiple package IDs as arguments and display their details in sequential order.
  • Extend winget install chaining to handle multiple packages in one command, processing them sequentially.
  • Ensure robust error handling for both commands so failures in one query or installation do not interrupt the rest.
  • Provide clear documentation and examples to educate users on this feature.

Technical Implementation Overview

To implement command chaining for winget show and winget install using the Winget COM API:

Argument Parsing:

Extend the Winget CLI to accept multiple package IDs or names as arguments for both commands (e.g., winget show Package1 Package2 or winget install Package1 Package2).
Batch Query and Installation:

For winget show: Invoke the FindPackages API sequentially for each package, or extend the COM API to support batch queries to minimize overhead.
For winget install: Use the InstallPackage method in sequence for multiple packages, ensuring robust error handling to skip failed installations without interrupting the process.

Enhanced Output and Error Handling:

Aggregate and format query results or installation progress for multiple packages into a clear, user-friendly output.
Gracefully handle invalid package names, query failures, or installation errors by logging and continuing with subsequent packages.

API Enhancements:

Introduce new batch methods like FindPackagesBatch or InstallPackagesBatch to allow the COM API to handle multiple packages in a single call, optimizing performance.

Backward Compatibility:

Ensure single-package queries and installations work seamlessly alongside the new multi-package chaining functionality. This approach streamlines workflows, reduces repetitive commands, and aligns Winget with the capabilities of other modern package managers like Homebrew and apt-get.

@davidldennison davidldennison added the Issue-Feature This is a feature request for the Windows Package Manager client. label Dec 7, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Dec 7, 2024
@Trenly
Copy link
Contributor

Trenly commented Dec 7, 2024

@davidldennison - you can already install multiple packages in a single install command similar to how you described

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage Issue need to be triaged label Dec 7, 2024
@davidldennison
Copy link
Author

@davidldennison - you can already install multiple packages in a single install command similar to how you described

@Trenly Oh sweet! I didn't know that as it's not in the documentation:

  1. https://github.com/MicrosoftDocs/windows-dev-docs/blob/docs/hub/package-manager/winget/install.md
  2. https://learn.microsoft.com/en-us/windows/package-manager/winget/install

Is there somewhere else I can find docs about this capability? Thanks in advance!

@Trenly
Copy link
Contributor

Trenly commented Dec 9, 2024

Is there somewhere else I can find docs about this capability? Thanks in advance!

I don’t know that there is any formal documentation, but here are the main items found just by searching for is:Closed Multiple in:Title in the issues search

@florelis
Copy link
Member

FWIW, that functionality is available for install, uninstall and upgrade. It's pretty subtle and should be documented better, but you can tell where it's supported because when you use --help it shows elipsis for the query argument:
usage: winget uninstall [[-q] <query>...] [<options>]

@denelon denelon added Issue-Docs It's a documentation issue that really should be on MicrosoftDocs and removed Issue-Feature This is a feature request for the Windows Package Manager client. labels Dec 10, 2024
@denelon denelon added this to WinGet Dec 10, 2024
@denelon denelon moved this to To Do in WinGet Dec 10, 2024
@denelon denelon self-assigned this Dec 10, 2024
@davidldennison
Copy link
Author

FWIW, that functionality is available for install, uninstall and upgrade. It's pretty subtle and should be documented better, but you can tell where it's supported because when you use --help it shows elipsis for the query argument: usage: winget uninstall [[-q] <query>...] [<options>]

WHATTTTTTT 🤯 @florelis that is such a golden nugget about the ellipsis!! Appreciate it! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Docs It's a documentation issue that really should be on MicrosoftDocs
Projects
Status: To Do
Development

No branches or pull requests

4 participants