PowerShell Command Output Needs Work #2796
Replies: 13 comments 24 replies
-
Here's another example of where the object fails. These break from expected PowerShell behaviors. |
Beta Was this translation helpful? Give feedback.
-
This tells me you aren't writing a valid PowerShell object to the pipeline. |
Beta Was this translation helpful? Give feedback.
-
I'd rather see a valid Powershell .Net object, than JSON. Which could then be easily converted to JSON. |
Beta Was this translation helpful? Give feedback.
-
I'm only suggesting JSON as a way to create a .NET object, even if it is a PSCustomObject. The problem is the convoluted nature of the COM object and there is different output from
|
Beta Was this translation helpful? Give feedback.
-
I'd be happy with a traditional .NET object, It isn't here yet based on my testing. |
Beta Was this translation helpful? Give feedback.
-
I think the Winget teams must answer a key design question: who is the target audience for the PowerShell module? I always tell my students, you need to consider who will be using your PowerShell commands? What are their expectations? What are the like use case scenarios you need to plan for? Answers to these questions help guide you on the choice of parameters, object property names, or whether you use parameter binding to name a few things. |
Beta Was this translation helpful? Give feedback.
-
EDIT: Ignore, I put what I originally posted here into a proper issue: #2799 |
Beta Was this translation helpful? Give feedback.
-
I knew I recognized that name, @jdhitsolutions . It must be hard to teach PowerShell Toolmaking in a Month of Lunches through posts on GitHub issues. 😉 |
Beta Was this translation helpful? Give feedback.
-
Why was the package manager already built into Windows, the PackageManagement Powershell provider, not used? Is WinGet that much better than OneGet? Was it forgotten? Do folks not realize Powershell is .Net, plus an amazing a command-line API? |
Beta Was this translation helpful? Give feedback.
-
Can't use the |
Beta Was this translation helpful? Give feedback.
-
@ryfu-msft is working on the improvements to the objects returned. |
Beta Was this translation helpful? Give feedback.
-
I'm experimenting with I'm still lured by this: which seems to suggest one can do: get-wingetpackage | ? { $_.Available -ne '' } @ryfu-msft suggests at #3069 (comment) to use this instead: get-wingetpackage | ? { $_.AvailableVersions -ne '' } But this doesnt' seem to produce the expected results either: Nor does get-wingetpackage | ? { $_.AvailableVersions -ne $null } |
Beta Was this translation helpful? Give feedback.
-
I know about the fact PowerShell does support displaying data in a way that's not a 1:1 match with the actual properties (I've been bitten e.g. by True, one can learn from: PS> get-wingetpackage | gm
TypeName: Microsoft.WinGet.Client.PSObjects.InstalledCatalogPackage
Name MemberType Definition
---- ---------- ----------
CheckInstalledStatus Method string CheckInstalledStatus()
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetPackageVersionInfo Method Microsoft.WinGet.Client.PSObjects.PackageVersionInfo GetPackageVersionInfo(string version)
GetType Method type GetType()
ToString Method string ToString()
AvailableVersions Property string[] AvailableVersions {get;}
Id Property string Id {get;}
IsUpdateAvailable Property bool IsUpdateAvailable {get;}
Name Property string Name {get;}
Source Property string Source {get;}
Version Property string Version {get;} but for some reason that always comes after I've hit some "unexpected behavior." We need to find the right balance... |
Beta Was this translation helpful? Give feedback.
-
So I finally got the PowerShell module working. I know it is alpha, which is why I'm bringing this up now. Object output needs to be more PowerShell-like. First glance, this looks good.
Until I try what most PowerShell users would try.
Ok. I get it. You have a format file to handle output from complex object. I can work with that.
I guess not. The NativeObject property is of no value to an IT Pro or end-user.
Command output should be a rich object, like system.diagnostics.process with the majority of properties "at the top". Your object is burying what the user wants to work with and makes this more complicated than it needs to be. Again, if Winget could return raw JSON, this would be so much easier than the COM object. I can't help but feel this approach is overkill.
Beta Was this translation helpful? Give feedback.
All reactions