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.02k stars 1.43k forks source link

prevent winget output from being truncated, which removes useful information (e.g. winget --info) #4523

Closed mattmazzola closed 3 months ago

mattmazzola commented 3 months ago

Description of the new feature / enhancement

Certain winget commands output text that is truncated. Alarmingly, this even occurs when output is redirected, such as to a file, which doesn't have a character width display constraint and there is not a reason to truncate.

Example

winget --info | Select-String -Pattern "%LOCALAPPDATA%\\Packages\\Microsoft\.DesktopAppInstaller_[\w]*\\LocalState\\s.*" | ForEach-Object { $_.Matches.Value }
%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…

Notice what I think is garbled Unicode … at the end, implying it seems truncated at the byte level and not clean character limit.

As #4521 mentions, because the output is not structured, it already requires hacks to get the desired value from it (see here I am using regex) and even more the value isn't complete which requires more hacks on assumptions based on knowing the full file name is settings.json

Expectation

The output of the above command should the expanded full path

%LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json

Related Issues

4521

4508

Proposed technical implementation details

It's not clear how the current output is produced but change that not to truncate.

github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

stephengillie commented 3 months ago

Hi @mattmazzola,

Please consider using the PowerShell cmdlets, including Get-WinGetSettings, which return PSObjects. For the query above, (Get-WinGetSettings).usersettingsfile might return the same data.

mdanish-kh commented 3 months ago

@mattmazzola Is this the same request as https://github.com/microsoft/winget-cli/issues/1653? If so, can we close this issue as duplicate and move the discussion there for better tracking?

[comment]: <[Policy] Needs-Author-Feedback>

mattmazzola commented 3 months ago

Yes, I think this is the same request

I think this issue gives better description of the problem, but I see the other issue has more activity.

I think it can be closed if you think appropriate

mdanish-kh commented 3 months ago

Thank you, please consider adding a comment if you can expand on the issue and giving it a 👍 to raise its priority. I'll close this one out.

Duplicate of #1653

microsoft-github-policy-service[bot] commented 3 months ago

Hello @mattmazzola,

We've identified this as a duplicate of another issue or PR that already exists. This specific instance is being closed in favor of the linked issue. Please add your 👍 to the other issue to raise its priority. Thanks for your contribution!

Template: msftbot/duplicate/closed