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

Show packages through winget #85

Merged
merged 2 commits into from
Jun 12, 2021
Merged

Show packages through winget #85

merged 2 commits into from
Jun 12, 2021

Conversation

rashil2000
Copy link
Member

As per #83

@jcwillox
Copy link
Member

jcwillox commented Jun 2, 2021

Cool, code looks fine, except you forgot to add package manager name "$wingetpkg (winget)", and based on my output at least there are only 3 lines to remove so it should be (winget list | Measure-Object).Count - 3

The other thing is while it makes sense for winget to be enabled by default it is very slow, about 3.1 seconds cold and 1.3 seconds hot, so we may not want it enabled by default 🤷‍♂️

@rashil2000
Copy link
Member Author

rashil2000 commented Jun 2, 2021

...forgot to add package manager name $wingetpkg (winget)...

This was actually intentional. The winget listing does not show packages installed by winget, it shows all the packages ever installed on the machine. (It mirrors the Programs list in Control Panel).

In my case I had observed two newlines in the beginning, then a header line, then the horizontal divider. So this makes it 4 extra lines. (both in Windows PowerShell and PowerShell Core)

Yes, I do agree that we should not have winget shown by default, since it fetches all those programs it takes quite some time.

@jcwillox
Copy link
Member

jcwillox commented Jun 2, 2021

This was actually intentional. The winget listing does not show packages installed by winget, it shows all the packages ever installed on the machine. (It mirrors the Programs list in Control Panel).

Sure, but you should always be clear where you're getting that information from, people using winget should already be aware that it lists all packages, otherwise filter only rows that have winget as their source (i.e. lines that end with winget).

In my case I had observed two newlines in the beginning, then a header line, then the horizontal divider. So this makes it 4 extra lines. (both in Windows PowerShell and PowerShell Core)

Mine only has 1 newline at the beginning, make sure you're using the latest version of winget, otherwise, just strip trailing newlines first then do the count.

@rashil2000
Copy link
Member Author

...otherwise filter only rows that have winget as their source (i.e. lines that end with winget).

That's not how it works. The entries that have winget as their source just means that that package is available in winget repos. It does not mean that that package has been installed through winget. I have 5 out of 140 programs that mention winget in their source, but 0 of them were installed via winget. I think what needs to be understood is that winget is not a traditional 'package manager', it's more of a generic program manager. Or, to be more pedantic, it's a CLI version of Control Panel's Programs page. And people using winget are most likely to be aware of this distinction. Mentioning (winget) in bracket would just give the false impression that they have been explicitly installed via winget, like scoop and choco.

And also, I'm on the latest version, v1.0.11451.

@jcwillox
Copy link
Member

jcwillox commented Jun 2, 2021

Well, no package can "technically" be installed through winget and there's no way to differentiate between a package installed through winget or not, just whether they can be installed/updated through winget.

Mentioning (winget) in bracket would just give the false impression that they have been explicitly installed via winget, like scoop and choco.

If you're listing all packages then I get what you mean, but saying nothing and listing it in the packages section is not ideal either, but I suppose if this is something people manually enable then they'll at least be able to tell what it refers to.

@rashil2000
Copy link
Member Author

...but I suppose if this is something people manually enable then they'll at least be able to tell what it refers to.

Exactly. This is also another reason to keep it off by default I guess.

@rashil2000
Copy link
Member Author

I have improved the counting part a bit and disabled winget by default.

@jcwillox jcwillox merged commit f4d0eb9 into master Jun 12, 2021
@jcwillox jcwillox deleted the winget-pkgs branch June 12, 2021 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants