PowerShell / PowerShell/PSResourceGet

Get-PSResource searching module folders

Offen
#1,012 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Area-GetPSResource
Vorherrschende Sprache
C#
Sterne
576
Forks
114
Ø Merge
1 T. 2 Std.
Gemergte PRs (30 T.)
7

Beschreibung

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.
Steps to reproduce

If you run Get-PSResource you'll notice that its appears to be searching in the module directories instead of $env:PSModulePath. You can especially see this behavior when searching for an explicit module.

It should only be searching like this:

  1. Loop through PSModulePath
  2. If name is specified limit search to directories with that name
  3. If version number is found look one folder deeper for module manifest
Get-PSResource -Name PowerShellGet
Expected behavior
Only required folders are searched when getting resources.
Actual behavior
PS C:\> Get-PSResource -Name PowerShellGet-Verbose
VERBOSE: Retrieving directories in the path 'C:\Users\Thomas\Documents\PowerShell\Modules'
VERBOSE: Retrieving directories in the path 'C:\Users\Thomas\Documents\PowerShell\Scripts'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.Chocolatey'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.Scoop'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\AnyPackage.WinGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\ClassExplorer'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Cobalt'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\CompletionPredictor'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\DirectoryPredictor'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\EditorServicesCommandSuite'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Foil'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\InvokeBuild'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\kbupdate'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\kbupdate-library'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.Archive'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.ConsoleGuiTools'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.Crescendo'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.GraphicalTools'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretManagement'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.SecretStore'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Microsoft.PowerShell.TextUtility'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\NewFile'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PackageManagement'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Pester'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Plaster'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\platyPS'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerGit'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGetCompat'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSCodeHealth'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSDesiredStateConfiguration'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSFramework'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSReadLine'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSScriptAnalyzer'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSSQLite'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\PSStringTemplate'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\Scoop'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\ScriptLog'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\SNMP'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\SqlServer'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\TabExpansionPlusPlus'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\UniversalPackageManager.PowerShellGet'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Modules\UniversalPackageManager.Provider.Msu'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Scripts\Export-PSObjectToINI.ps1'
VERBOSE: All paths to search: 'C:\Users\Thomas\Documents\PowerShell\Scripts\Get-WindowsAutoPilotInfo.ps1'
VERBOSE: Entering GetPSResource
VERBOSE: Searching through package path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: Searching through package path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.19'
VERBOSE: Package version parsed as NuGet version: '3.0.19-beta19'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.19\PSGetModuleInfo.xml'

VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.17'
VERBOSE: Package version parsed as NuGet version: '3.0.17-beta17'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.17\PSGetModuleInfo.xml'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.16'
VERBOSE: Package version parsed as NuGet version: '3.0.16-beta16'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.16\PSGetModuleInfo.xml'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.14'
VERBOSE: Package version parsed as NuGet version: '3.0.14-beta14'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.14\PSGetModuleInfo.xml'
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.12'
VERBOSE: The PSGetModuleInfo.xml file found at location: C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.12\PSGetModuleInfo.xml cannot be parsed due to TryReadPSGetInfo: Cannot read the PowerShellGet information file with error: Could not find file 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\3.0.12\PSGetModuleInfo.xml'.
VERBOSE: Searching through package version path: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\2.2.5'
VERBOSE: Package version parsed as NuGet version: '2.2.5.0'
VERBOSE: Reading package metadata from: 'C:\Users\Thomas\Documents\PowerShell\Modules\PowerShellGet\2.2.5\PSGetModuleInfo.xml'
Error details

No response

Environment data
Name          Version
----          -------
PowerShellGet 3.0.19

Name                           Value
----                           -----
PSVersion                      7.4.0-preview.2
PSEdition                      Core
GitCommitId                    7.4.0-preview.2
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Visuals

No response

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie damit, Get-PSResource -Name PowerShellGet zu reproduzieren und den Sucheinstiegspunkt Get-PSResource zu überprüfen. Verfolgen Sie, wie $env:PSModulePath zu den Suchpfaden wird, und fügen Sie dann eine Abdeckung für das gemeldete Verhalten hinzu oder aktualisieren Sie sie. Als abgeschlossen gilt die Änderung, wenn eine explizite Modulsuche nur die erforderlichen Modulverzeichnisse und Versionsunterordner prüft.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp, powershell
Bereich
cli, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.