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

Improvements to the list command #964

Open
denelon opened this issue May 14, 2021 · 17 comments
Open

Improvements to the list command #964

denelon opened this issue May 14, 2021 · 17 comments
Labels
Area-Performance Issue related to CPU or memory performance Command-List Issue related to WinGet List Issue-Feature This is a feature request for the Windows Package Manager client.
Milestone

Comments

@denelon
Copy link
Contributor

denelon commented May 14, 2021

Description of the new feature/enhancement

We need to build a cache to improve performance for the list command.

We need to record everything installed by the Windows Package Manager explicitly.

Proposed technical implementation details (optional)

@denelon denelon added the Issue-Feature This is a feature request for the Windows Package Manager client. label May 14, 2021
@ghost ghost added the Needs-Triage Issue need to be triaged label May 14, 2021
@denelon denelon removed the Needs-Triage Issue need to be triaged label May 14, 2021
@ev-dev
Copy link

ev-dev commented May 24, 2021

We need to record everything installed by the Windows Package Manager explicitly.

Hey @denelon glad to see this issue! For me and likely many other users, this is an essential feature needed before adopting winget as a default package manager.

It's a bit more than just an inconvenience because the situation is compounded by the fact that many current winget users also use chocolatey, scoop, or both, and so the ability to list packages installed specifically with winget should be considered a vital operation. I would argue that this issue is worthy of a high priorty 👍

@denelon
Copy link
Contributor Author

denelon commented May 24, 2021

@ev-dev be sure to add your 👍 to the issue. We often sort by most 👍 to find high priority / high value features. We have a large number of Issues in v.Next right now to evaluate for v1.1.

@Karl-WE
Copy link
Contributor

Karl-WE commented May 25, 2021

while there is a search option in the consoles of cmd and PowerShell (Ctrl+F) there is no search in Windows Terminal yet.

How about:
The list command (same as search) has an an optional paged output as if you would pipe it to "more"
e.g. get-childitem (ls) | more

just tested winget search / list support piping to more.

examples:

winget list -p / winget list --p
winget search -p / winget list --p

@jypeter
Copy link

jypeter commented Sep 8, 2022

I have just discovered winget, but the the winget list order makes no sense (at least not to me)

Is there a way to get a list sorted in alphabetical order of the package names? I would use | sort in Linux, but I'm not familiar with PowerShell syntax

@denelon
Copy link
Contributor Author

denelon commented Sep 8, 2022

@JohnMcPMS do you know what might be driving the order of the output for winget list?

@jypeter
Copy link

jypeter commented Dec 15, 2022

I'm experimenting with winget again, and I'm surprised there is still no way to get a usable sorted list of winget list. That's a shame, as winget list output is getting bigger and bigger each time I use it!

My use case here is that I have recently installed the emacs text editor with winget install --id GNU.Emacs (it was really nice to be able to do that!), and I wanted to use winget list to check which version I had. I ended up scrolling back and forth several times to check the output and not finding anything

Now, I have also use the following, and found out that emacs did not appear in the list at all, but that's probably another problem (maybe some packages don't appear in the list, because something was not done properly in the installation package). EDIT: I see this has been recently mentioned in microsoft/winget-pkgs#88443

PS C:\Users\your_login> winget list --id GNU.Emacs
Aucun package installé ne correspond aux critères saisis.

I can do the following, with WSL installed, but it's kind of an overkill. And I don't want to learn PowerShell syntax (I'm a Linux user and I like python and bash for scripting)

PS C:\Users\jypeter> winget list | wsl sort

-----------------------------------------------------------------------------------------------------------------------
3D Builder                             Microsoft.3DBuilder_8wekyb3d8bbwe      18.0.1931.0
7-Zip 22.01 (x64)                      7zip.7zip                              22.01                              winget
Adobe Acrobat Reader - Fran??ais        {AC76BA86-7AD7-1036-7B44-AC0F074E4100} 22.003.20282
Adobe Acrobat XI Pro                   {AC76BA86-1033-FFFF-7760-000000000006} 11.0.23
Adobe Flash Player 32 NPAPI            {FDC0C70F-866A-49EF-A886-D7FE22409CDA} 32.0.0.156
Adobe Genuine Service                  AdobeGenuineService                    8.1.0.3
Adobe Illustrator CS6                  {4869414E-7AEA-4C8E-BE1C-8D40977FD517} 16.0
Amazon Games                           Amazon.Games                           2.2.8063.2                         winget

@Trenly
Copy link
Contributor

Trenly commented Jun 16, 2023

[Policy] Command-List

@denelon / @stephengillie - Also should have Area-Performance

@microsoft-github-policy-service microsoft-github-policy-service bot added the Command-List Issue related to WinGet List label Jun 16, 2023
@denelon denelon added the Area-Performance Issue related to CPU or memory performance label Jun 16, 2023
@jypeter
Copy link

jypeter commented Jun 4, 2024

I have just used winget list again, and the default list order still does not make any obvious sense. I'm apparently using winget v1.7.11261

I see I can get a more sensible output using winget list | sort #4238 (comment). It's good to know that you can use a pipe in PowerShell, but a sensible defaut order and additional sort options would not hurt

@stephengillie
Copy link

stephengillie commented Jun 4, 2024

Please consider using the PowerShell cmdlets for the package manager, such as Get-WinGetPackage, which should have equivalent output to winget list. And these output PSObjects which can be easier to work with and manipulate than raw strings.

@jypeter
Copy link

jypeter commented Jun 5, 2024

Trouble is that I only use PowerShell as a terminal (in a Windows Terminal)

I mostly use Linux related shells and programming tools on remote servers, and I'm not going to spend time learning PS prpgramming, unless it exactly matches what I already use for Linux (like winget list | sort)

@stephengillie
Copy link

stephengillie commented Jun 5, 2024

Ah - please accept this as a type of workaround: If you're going to implement winget list | sort, then a slight change to Get-WinGetPackage | sort name should give more consistent results, while also adding the ability to sort by column.

For instance:

  • Get-WinGetPackage | sort name to have the output sorted by package name
  • Get-WinGetPackage | sort Id to have the output sorted by PackageIdentifier

And this would work for Version and Source columns as well.

Edit: Need to specify the column name for Get-WinGetPackage, or sort doesn't know which column to sort against, it would seem, as it returns unsorted results. Guessing this doesn't happen with winget list because it's only returning a string array for sort to interpret.

@jypeter
Copy link

jypeter commented Jun 5, 2024

I have directly pasted the command in a PS, but I'm getting a command not found error. Am I doing something wrong, or do I have to install some extra stuff (providing Get-WinGetPackage)?

PS C:\Users\jypeter> Get-WinGetPackage | sort name
Get-WinGetPackage : Le terme «Get-WinGetPackage» n'est pas reconnu comme nom d'applet de commande, fonction, fichier de script ou programme
exécutable. Vérifiez l'orthographe du nom, ou si un chemin d'accès existe, vérifiez que le chemin d'accès est correct et réessayez.
Au caractère Ligne:1 : 1
+ Get-WinGetPackage | sort name
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-WinGetPackage:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

@stephengillie
Copy link

stephengillie commented Jun 5, 2024

Sorry, I thought these would be present. The module might need to be installed and imported:

  • Install-Module Microsoft.WinGet.Client
  • Import-Module Microsoft.WinGet.Client

If this is too far afield, it's okay.

@Karl-WE
Copy link
Contributor

Karl-WE commented Jun 5, 2024

Read earlier that PS 7.x and 5.1 differ for thes capabilities of the module. Where PS 7.x takes the lead.

@jypeter
Copy link

jypeter commented Jun 7, 2024

Thanks @stephengillie !

I have succesfully used the Install-Module Microsoft.WinGet.Client and Import-Module Microsoft.WinGet.Client commands

I had to use an elevated PS and accept something called NuGet. I hope all of this is legit

PS C:\Users\jypeter> Install-Module Microsoft.WinGet.Client

Le fournisseur NuGet est requis pour continuer
PowerShellGet requiert le fournisseur NuGet, version 2.8.5.201 ou ultérieure, pour interagir avec les référentiels
NuGet. Le fournisseur NuGet doit être disponible dans « C:\Program Files\PackageManagement\ProviderAssemblies » ou «
C:\Users\jypeter\AppData\Local\PackageManagement\ProviderAssemblies ». Vous pouvez également installer le fournisseur
NuGet en exécutant la commande « Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force ». Voulez-vous
que PowerShellGet installe et importe le fournisseur NuGet maintenant ?
[O] Oui  [N] Non  [S] Suspendre  [?] Aide (la valeur par défaut est « O ») : O

Référentiel non approuvé
Vous installez les modules à partir d'un référentiel non approuvé. Si vous approuvez ce référentiel, modifiez sa valeur
 InstallationPolicy en exécutant l'applet de commande Set-PSRepository. Voulez-vous vraiment installer les modules à
partir de PSGallery ?
[O] Oui  [T] Oui pour tout  [N] Non  [U] Non pour tout  [S] Suspendre  [?] Aide (la valeur par défaut est « N ») : O

Afterwards, I was indeed able to get a sorted output of winget. This solution works fine and is an acceptable workaround. But it is also kind of an overkill, and I hope someone will eventually add the required sorting options to winget

PS C:\Users\jypeter> Get-WinGetPackage | sort name

Name                                          Id                                                Version             Available Source
----                                          --                                                -------             --------- ------
7-Zip                                         7zip.7zip                                         22.01               24.06     winget
Adobe Acrobat XI Pro                          {AC76BA86-1033-FFFF-7760-000000000006}            11.0.23
[...]
XnView                                        XnSoft.XnView.Classic                             2.51.5              2.51.6    winget
Zoom Workplace                                XP99J3KP4XZ4VV                                    6.0.11 (39959)                mss...
Zotero                                        DigitalScholar.Zotero                             6.0.15              6.0.36    winget

@stephengillie
Copy link

@jypeter,

I'm very sorry for giving bad advice in this thread. It definitely was overkill and I'll avoid doing so in the future.

@jypeter
Copy link

jypeter commented Jun 10, 2024

@stephengillie Do not worry, I think your answer was quite relevant and I have added it to my small winget documentation!

But I do hope some winget developper (@denelon ?) will eventually address the following questions:

  • determine what the current order of winget list is. Note: I have just discovered the WinGet CLI Settings page. I did not have a %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json file and I guess I was really using the default settings. But anyway, this page does not mention anything about sorting
  • change the default order to be sorted by package name. This will make some sense and be useful
  • add sorting options to winget

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Performance Issue related to CPU or memory performance Command-List Issue related to WinGet List Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

No branches or pull requests

6 participants