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
23.32k stars 1.45k forks source link

`Get-WinGetConfiguration` default `-Path` to what `winget config` points to #4637

Open o-l-a-v opened 4 months ago

o-l-a-v commented 4 months ago

Description of the new feature / enhancement

Microsoft.WinGet.Configuration v1.8.1911-alpha: https://www.powershellgallery.com/packages/Microsoft.WinGet.Configuration/1.8.1911-alpha

Instead of requiring input for -Path on Get-WinGetConfiguration, default to the WinGet config default path, also opened by winget config?

If you accept this change this should also be applied to other cmdlets getting or setting WinGet config.

Proposed technical implementation details

No response

mdanish-kh commented 4 months ago

As mentioned in https://github.com/microsoft/winget-cli/issues/4636#issuecomment-2227427928, the WinGet user settings JSON file is not a valid WinGet configuration file. I'm assuming from the issues you've opened that you're looking for a way to fetch / set WinGet user settings through PowerShell. For that, I would recommand the Microsoft.WinGet.Client PowerShell module that contains cmdlets Get-WinGetUserSettings and Set-WinGetUserSettings

 ~ Get-WinGetUserSettings

Name                           Value
----                           -----
experimentalFeatures           {[sideBySide, True], [configureExport, True]}
network                        {[downloader, wininet]}
visual                         {[progressBar, retro]}
$schema                        https://aka.ms/winget-settings.schema.json
 ~ Set-WinGetUserSettings -UserSettings @{ "network" = @{ "downloader" = "do" } }

Name                           Value
----                           -----
$schema                        https://aka.ms/winget-settings.schema.json
network                        {[downloader, do]}

Keep in mind Set-WinGetUserSettings would erase all other settings if they're not specified.

[comment]: <[Policy] PowerShell> [comment]: <[Policy] Issue-Docs>

stephengillie commented 4 months ago

In some ways, this is more of "Make the package manager application and the package manager cmdlets operate in the same way."