-
Couldn't load subscription status.
- Fork 295
feat(completions): Update winget-completions.nu for winget v1.11.510 #1183
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
base: main
Are you sure you want to change the base?
Conversation
I'm not a fan of having raw winget cli output. This is supposed to be a nushell script. if detect columns works great, as indicated in all this text, then it should be used to format the output in nushell tables. |
|
Hi @fdncred, Thanks a lot for the feedback! I really appreciate you taking the time to review this in detail.
I completely understand your concern. AI-generated code can sometimes miss the intention or lack quality, especially without sufficient human review. I admit that this PR was initially generated by AI, but I manually verified it by comparing the previous and current implementations. In this case, it was a very clear and well-defined change, so it was easy for AI to understand my intention: mapping help messages to completions. I’ve tested the new version on two of my own PCs, and in my main usage scenarios (such as I hope this helps address your concern.
I agree that ideally, the output should be nicely formatted in Nushell tables. However, parsing raw winget CLI output is extremely difficult because it’s not machine-readable: the separators are inconsistent, and some cells may be empty, which breaks any structured parsing logic or makes it too complex. Microsoft’s PowerShell implementation faced the same issue. They avoid parsing the CLI output either. Their solution was to bypass the CLI entirely and instead call the underlying COM/WinRT interface directly. Given that limitation, I believe returning the raw CLI output is currently the most pragmatic and maintainable approach. If winget ever provides a structured output format in the future (e.g., JSON or XML), I’d be happy to revisit this and add proper Nushell formatting then. Thanks again for the constructive discussion!
|
|
@fdncred kindly ping for your feedback. |
|
I understand your points about winget not supporting a structured output format, shame on them. But I'm not inclined to land a version of this that removes the nushell tables. Seems like regex could be used here to make the tables or maybe there's some other way based on how powershell does it? |
|
Hi @fdncred, Thanks for clarifying — I see the core issue now is whether this completion should keep parsing into Nushell tables. Let me show you why I was hesitant to say “let’s just regex it,” using the exact output shape from the screenshot I tested with.
The data itself looks like a table, but it’s only visually aligned. In the screenshot the gaps between columns aren’t consistent. On the line with Some rows contain values that “look like” other columns. The name Some Version cells are not “plain versions”. On the And all of this can change with terminal width. Because of all that, my takeaway is: we can write a regex that works on this screenshot, but we can’t write a simple, stable regex that works on “arbitrary winget output on arbitrary user machines” — which is what we want for completions. That’s also why I mentioned PowerShell earlier: Microsoft’s own PowerShell integration doesn’t try to parse the CLI text output either — they skip the CLI and talk directly to the COM/WinRT layer underneath, because that’s the only place where the data is actually structured. In other words, even the people closest to winget decided “parsing the pretty console output” is the wrong abstraction. So that’s the reasoning behind my proposal: in Nushell, unless we also go to a structured source (like PS did), returning the raw CLI output is the most honest and the least fragile thing we can do right now. If/when winget gives us JSON/XML, I’m 100% on board with tables. |


Winget Completions Update Summary
Overview
Successfully updated the winget-completions.nu file for Windows Package Manager v1.11.510.
Changes Made
1. Gathered Complete Documentation
winget-help-dumps/folder for future reference2. Major Updates
New Commands Added
winget pin- Manage package pins (with subcommands: add, remove, list, reset)winget download- Downloads the installer from a given packagewinget configure- Configures the system into a desired state (mentioned but not fully implemented)winget repair- Repairs the selected package (mentioned but not fully implemented)winget dscv3- DSC v3 resource commands (mentioned but not fully implemented)Enhanced Existing Commands
All commands now include the full set of global options:
--wait- Prompts before exiting--logs/--open-logs- Open logs location--verbose/--verbose-logs- Enable verbose logging--nowarn/--ignore-warnings- Suppress warnings--disable-interactivity- Disable interactive prompts--proxy- Set proxy for execution--no-proxy- Disable proxy for executionNew Options in Install/Upgrade Commands
--architecture (-a)- Select architecture--installer-type- Select installer type--custom- Additional arguments for installer--ignore-security-hash- Ignore hash check failures--allow-reboot- Allow system reboots--skip-dependencies- Skip dependency processing--ignore-local-archive-malware-scan- Ignore malware scans--dependency-source- Source for dependencies--no-upgrade- Skip upgrades if already installed--authentication-mode- Authentication preference--authentication-account- Account for authentication--rename (-r)- Rename executable (portable)--uninstall-previous- Uninstall old version during upgradeEnhanced List/Search Commands
--cmd/--command- Filter by command--upgrade-available- Show only upgradable packages--unknown/--include-unknown- Include packages with unknown versions--pinned/--include-pinned- Include pinned packages--versions- Show available versionsEnhanced Uninstall Command
--product-code- Filter by product code--all/--all-versions- Uninstall all versions--purge- Delete all package files--preserve- Retain created filesSource Management Updates
--trust-leveloption for source add--explicitflag for source add3. Improved Completion Functions
Updated Completers
nu-complete winget sources- Lists available package sourcesnu-complete winget scope- user/machine scope optionsnu-complete winget locale- BCP47 locale codesnu-complete winget architecture- x86, x64, arm, arm64, neutralnu-complete winget installer-type- All installer typesnu-complete winget authentication-mode- silent, silentPreferred, interactivenu-complete winget source-type- Microsoft.PreIndexed.Package, Microsoft.Restnu-complete winget trust-level- none, trustedNew Completers
nu-complete winget installed packages- Caches installed packages for uninstall completionsnu-complete winget search packages- Placeholder for search package completions4. Syntax Improvements
@for attaching completers to type annotationswinget add,winget view,winget find, etc.)5. Documentation
Files Created
winget-help-dumps/- Directory containing all winget help outputswinget.txt- Main command helpinstall.txt- Install command helpshow.txt- Show command helpsearch.txt- Search command helplist.txt- List command helpupgrade.txt- Upgrade command helpuninstall.txt- Uninstall command helpsource.txt- Source command helpsource-add.txt- Source add subcommand helpsource-list.txt- Source list subcommand helpexport.txt- Export command helpimport.txt- Import command helphash.txt- Hash command helpvalidate.txt- Validate command helppin.txt- Pin command helpdownload.txt- Download command helpsettings.txt- Settings command helpfeatures.txt- Features command helpTesting
Breaking Changes
Removed Structured Data Output Functions
The following custom functions that parsed winget output into structured NuShell tables have been removed:
winget source list- Previously returned parsed table withNameandArgumentcolumnswinget source listreturned a structured tableexterndeclaration, returns raw winget CLI output| detect columnswinget search- Previously returned parsed table withname,id,version,match,sourcecolumnswinget search <query>returned a structured table with--rawflag to disable parsingexterndeclaration, always returns raw winget CLI output| detect columnsor custom parsing to get structured datawinget list- Previously returned parsed table withname,id,version,available,sourcecolumnswinget listreturned a structured table with--rawflag to disable parsingexterndeclaration, always returns raw winget CLI output| detect columnsor custom parsing to get structured datawinget upgrades(internal function) - Previously parsed upgrade list into structured dataRemoved Helper Functions
nu-complete winget flagify- Internal helper for building command flagsnu-complete winget trimLoadingSymbol- Internal helper for cleaning winget outputRationale for Changes
The structured output functions were removed because:
detect columnsMigration Guide
If you relied on the structured output:
Recent Improvements (Based on Cargo/Eza Completions)
Code Quality Enhancements
Enhanced Documentation
@category package-managerannotations to all main commands@exampleannotations with practical use cases for key commands:winget install- 3 examples (by name, specific version, silent install)winget show- 2 examples (package info, available versions)winget search- 2 examples (basic search, exact ID search)winget list- 3 examples (all packages, upgrades, by source)winget upgrade- 3 examples (show upgrades, upgrade all, specific package)winget uninstall- 2 examples (by name, by ID)Improved Completion Functions
Better Code Organization
Notes
externdeclarations for consistency and maintainability