PowerShell Version
Both 5.1 and 7.x
Operating System
Windows
Module Version
Latest
What happened?
Get-ChocoLatestPackage is using choco list to search for the latest version of a package. When provided with a source this will not work at all, and when not provided a source it will return the package version currently installed.
Expected behavior
This should ideally work on the latest supported version of Chocolatey.
Minimal reproduction
I have merely looked at the code: https://github.com/PowerShellOrg/PSDepend/blob/main/PSDepend/PSDependScripts/Chocolatey.ps1#L98. To verify the Chocolatey execution: choco list glab.portable --limit-output --exact --source="chocolatey" is the command that it would run, and this results in When using the '--source' option with the 'choco list' command, only a named alternative source can be provided. Without a source it would result in calling choco list glab --limit-output --exact which works, but list only shows the installed packages.
Error output / logs
Additional context
Some information on the changes can be found here: https://docs.chocolatey.org/en-us/guides/upgrading-to-chocolatey-v2-v6/#querying-remote-sources
PowerShell Version
Both 5.1 and 7.x
Operating System
Windows
Module Version
Latest
What happened?
Get-ChocoLatestPackageis usingchoco listto search for the latest version of a package. When provided with a source this will not work at all, and when not provided a source it will return the package version currently installed.Expected behavior
This should ideally work on the latest supported version of Chocolatey.
Minimal reproduction
I have merely looked at the code: https://github.com/PowerShellOrg/PSDepend/blob/main/PSDepend/PSDependScripts/Chocolatey.ps1#L98. To verify the Chocolatey execution:
choco list glab.portable --limit-output --exact --source="chocolatey"is the command that it would run, and this results inWhen using the '--source' option with the 'choco list' command, only a named alternative source can be provided.Without a source it would result in callingchoco list glab --limit-output --exactwhich works, butlistonly shows the installed packages.Error output / logs
Additional context
Some information on the changes can be found here: https://docs.chocolatey.org/en-us/guides/upgrading-to-chocolatey-v2-v6/#querying-remote-sources