PowerShell / PSResourceGet

PSResourceGet is the package manager for PowerShell
https://www.powershellgallery.com/packages/Microsoft.PowerShell.PSResourceGet
MIT License
486 stars 92 forks source link

PSResourceGet exports the $PSGetPath variable but never sets the value #1625

Open sdwheeler opened 6 months ago

sdwheeler commented 6 months ago

Prerequisites

Steps to reproduce

In a new session import PSResourceGet but don't import PowerShellGet v2. Examine the value of $PSGetPath.

Expected behavior

PS> Get-Variable PSGetPath -ValueOnly

AllUsersModules    : C:\Program Files\PowerShell\Modules
AllUsersScripts    : C:\Program Files\PowerShell\Scripts
CurrentUserModules : C:\Users\sewhee\Documents\PowerShell\Modules
CurrentUserScripts : C:\Users\sewhee\Documents\PowerShell\Scripts

Actual behavior

PS> Get-Variable PSGetPath -ValueOnly
Get-Variable: Cannot find a variable with the name 'PSGetPath'.

Error details

No error.

The variable $PSGetPath was added to PowerShellGet v2 in https://github.com/PowerShell/PowerShellGetv2/pull/486. The variable is never used by the modules, it is provided to give users information about the location of the Modules and Scripts folder for each scope.

PSResourceGet exports the variable in the module manifest, but nowhere in code does it set the value.

Environment data

PS> gmo -list Microsoft.PowerShell.PSResourceGet

    Directory: C:\Users\sewhee\Documents\PowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Binary     1.0.2                 Microsoft.PowerShell.PSResourceGet  Core,Desk {Find-PSResource, Get-InstalledPSResour…
Binary     1.0.0                 Microsoft.PowerShell.PSResourceGet  Core,Desk {Find-PSResource, Get-InstalledPSResour…

Visuals

No response

LaurentDardenne commented 5 months ago

it seems that there is no documentation of this variable...