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
22.92k stars 1.42k forks source link

Use native PowerShell progress bar instead of ugly shell simulated progress bar #1429

Open soroshsabz opened 3 years ago

soroshsabz commented 3 years ago

Description of the new feature/enhancement

Replace PowerShell progress bar instead of ugly shell based progress simulated when we try download to install package in PowerShell with winget

I think it is good to replace below

image

with

image

Proposed technical implementation details (optional)

I suggest using write-progress command when using winget in PowerShell to make better user experience in PowerShell eco-system and feel in-house and native command in PowerShell

This blog is very helpful for writing progress bar in powershell, and this progress can easily show percentage, bytes remaining and speed( this is very needed for downloading from internet with limited speed)

soroshsabz commented 3 years ago

related to #221

related to #674

related to #1088

jedieaston commented 3 years ago

This needs to be user configurable. The PowerShell progress bar (at least in 5.1) is buggy as heck whenever I try to use it, so most of the time I suppress it. The winget progress bar works fine, on the other hand.

denelon commented 3 years ago

This would be configurable just like "rainbow", "retro", etc.

jantari commented 2 years ago

For what it's worth the PowerShell-native progress bar has been changed to look pretty similar to the current one winget presents in PowerShell 7.2

I personally don't think this is a pressing issue as progress bars are a UI feature for interactive users (humans) and that's not really how I'm going to use winget - but if it's not too much work, sure.

soroshsabz commented 2 years ago

@jantari I think it is important to Microsoft ecosystem is being consistent, so I think all Microsoft CLI app must be used native PowerShell progress bar if the app need progress bar, to achieve same UX in Microsoft ecosystem.

https://it-overload.com/2021/03/02/the-beauty-of-progress-bar-in-powershell-7-2-preview-3/

as you can see, and as you can say, if we are using native PowerShell progress bar we can achieve all benefit of working in PowerShell Core. if some day PowerShell team decide to change progress bar and make it better than now, winget can take all the benefit of PowerShell facilities without paying any cost.

thanks

VivaLosDoyers commented 2 years ago

What about for those us that don't use PowerShell though? Keep this is a fallback?

rdeforest commented 2 years ago

For those of us who think the default PowerShell progress bar is ugly, we can at least improve the colors by putting something like this in ~/Documents/WindowsPowerShell/profile.ps1

$Host.PrivateData.ProgressForegroundColor='White'
$Host.PrivateData.ProgressBackgroundColor='Blue'

I still strongly favor the winget progress bar, especially since it provides additional useful information: 486 MB / 510 MB in the example.

RokeJulianLockhart commented 2 years ago
  1. https://github.com/microsoft/winget-cli/issues/1429#issuecomment-931639466 and
  2. https://github.com/microsoft/winget-cli/issues/1429#issuecomment-912611004

@rdeforest, if that is problematic for you, report that to the maintainers of PowerShell, because if those problems are remediated, the applications shall gain consistent indicators of progress.

jedieaston commented 2 years ago

It's a problem in PowerShell 5.1, as far as I can tell it's fine (or at least, better) in PowerShell 7. I don't think PowerShell 5.1 is being supported for anything other than emergency bug fixes, or else I would (although I'm sure they're aware of it).

rdeforest commented 2 years ago

http://github.com/microsoft/winget-cli/issues/1429#issuecomment-931639466, and http://github.com/microsoft/winget-cli/issues/1429#issuecomment-912611004.

If that is problematic for you, report that to the maintainers of PowerShell, because if those problems are remediated, this software shall gain consistent indicators of progress, and PowerShell's shall have been improved.

Yes, improving PowerShell is a great idea, but this issue #1429 is about the winget-cli project. Improving the PS progress bar is out of scope.

When there is no feature gap between the progress bars in winget and PowerShell then this issue will have some legs. Until then it should be maximally de-prioritized in favor of work which will make winget better.

I don't speak for the winget-cli team, I'm just a person on the Internet with opinions.

Masamune3210 commented 2 years ago

Oh, definitely fix the actual issues first

Karl-WE commented 1 year ago

Ihmo it looks prettier in Microsoft Terminal and PowerShell 7.x

Spacellary commented 1 year ago

Just feedback from a regular user here, but I'd much prefer a mix of both, but more so a PowerShell 7.x styled one but in Gray or B/W.

RokeJulianLockhart commented 1 year ago

https://github.com/microsoft/winget-cli/issues/1429#issuecomment-1443430771

@Spacellary, I believe that Write-Progress accepts colouration parameters, although I admit that I don't see any reference to this at https://github.com/MicrosoftDocs/PowerShell-Docs/blob/86925ef514369544b5b6e6502172c81f66c09126/reference/7.4/Microsoft.PowerShell.Utility/Write-Progress.md#parameters.

davidldennison commented 3 months ago

Add this to your settings.json config file for Winget to get a nice rainbow version

"visual": {
        "progressBar": "rainbow",

image

Karl-WE commented 3 months ago

@soroshsabz is this still something you pursue or is the one from @davidldennison plus the Windows Terminal View in PowerShell 7.x enough? Thank you for considering housekeeping and close if no longer requested.

soroshsabz commented 3 months ago

As @RokeJulianLockhart said, I think winget-cli can implement progress bar with native PowerShell progress bar feature and I think it is very odd to winget-cli does not support native PowerShell Progress Bar

soroshsabz commented 3 months ago

Integration, Consistency and Ecosystem driven is keys of Major Software Company for way of success

Karl-WE commented 3 months ago

I see your point clearer now. Can just believe they do not want to use PowerShell progress bar to reduce dependencies. imagine that something in progress bar commandlet changes, and this would break winget.

As PS is not maintained by winget team, you might understand the complexity. In addition, PS 5.1, 7 or later might have different syntax. this is usually the case for other commands as well. Not speaking for winget team at all, just bringing up my thoughts why they might have chosen this way. When winget has been released, it had no PowerShell support. +1 for consistency :)