jdhitsolutions / WingetTools

A set of PowerShell tools for working with the winget package manager.
MIT License
146 stars 14 forks source link

[Bug]: Get-WGPackage does not return all the object properties #5

Closed MitushYadav closed 2 years ago

MitushYadav commented 2 years ago

Describe the problem

Running Get-WGPackage -id 'putty.putty' returns

Name : PuTTY ID : PuTTY.PuTTY Version : Publisher : PublisherURL : PublisherSupport : Author : Moniker : Description : Homepage :

Expectation

The command should return more details.

Additional Information

winget v1.2.10271

I looked into the private.ps1 and these could be the potential fixes:

  1. functions\private.ps1 $value = $find.split("$($key):")[1].trim() => $value = $($find -split "$($key):")[1].trim()

  2. The string for Publisher Url do not match: PublisherURL => Publisher Url PublisherSupport => Publisher Support Url reference: winget-pkgs

PowerShell version

5.1

Platform

Windows 10 Pro or Enterprise

Additional Checks

MitushYadav commented 2 years ago

I saw you had something similar for the string split in v1.1.1. Any reason for changing it?

jdhitsolutions commented 2 years ago

One of the challenges of using regex is that you expect output the be consistent. Sometimes it isn't. Let me see what I can do.,

jdhitsolutions commented 2 years ago

The first time I tried the command I got the same results you did. But when I ran it again, it worked.

image

Not every package provides all details but this looks like it is working. The first time you run winget after some unknown period of time, It writes other output which I thought I had accounted for. I hadn't used winget in several days so initially got your result. But running it a second time and everything worked.

jdhitsolutions commented 2 years ago

But I can see now that publisher info isn't properly parsing.

jdhitsolutions commented 2 years ago

I had something else in mind for parsing out the publisher data but apparently, I didn't think it all the way through. Working on an update that should work.

jdhitsolutions commented 2 years ago

Update the module to v1.3.0 and see if it works better for you.

MitushYadav commented 2 years ago

Updated to v1.3.0 and I get the required output. Thanks!