From 8fd17fcdf95ea74e9c604cb5f1f75685de3ee58a Mon Sep 17 00:00:00 2001 From: Josh Dearing Date: Wed, 21 May 2025 18:13:48 -0500 Subject: [PATCH 1/2] Resolved issue with duplicate module names --- .../functions/Show-ModuleExplorer.ps1 | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ModuleExplorer/functions/Show-ModuleExplorer.ps1 b/ModuleExplorer/functions/Show-ModuleExplorer.ps1 index d1c4565..2d4a016 100644 --- a/ModuleExplorer/functions/Show-ModuleExplorer.ps1 +++ b/ModuleExplorer/functions/Show-ModuleExplorer.ps1 @@ -91,14 +91,20 @@ function Show-ModuleExplorer { # Reset the main loop if modules changes (install/remove) $moduleLookup.Clear() $moduleChoices = @($exitChoiceString, $refreshChoiceString) - - $moduleChoices += $availableModules | ForEach-Object { - $versionString = if ($_.Version) { "v$($_.Version)" } else { "Version N/A" } - $displayName = "$($_.Name) ($versionString)" - $moduleLookup[$displayName] = $_ # Populate the lookup table - $displayName + + $processedDisplayNames = @{} + + foreach ($module in $availableModules) { + $versionString = if ($module.Version) { "v$($module.Version)"} else { "Version N/A" } + $displayName = "$($module.Name) ($versionString)" + + if (-not $processedDisplayNames.ContainsKey($displayName)) { + $moduleLookup[$displayName] = $module + $moduleChoices += $displayName + $processedDisplayNames[$displayName] = $true + } } - + $promptTitle = "[yellow bold]Select a PowerShell Module to Explore (or Exit):[/]" Write-SpectreRule -Title "[grey] Installed Modules: $($availableModules.Count) [/]" -Alignment Center $selectedModuleDisplay = Read-SpectreSelection -Message $promptTitle -PageSize 15 -Choices $moduleChoices -EnableSearch @@ -122,7 +128,7 @@ function Show-ModuleExplorer { Read-SpectrePause -Message "[grey]Press Enter to continue...[/]" -NoNewline continue } - + Clear-Host Show-ModuleCommandViewer -SelectedModule $selectedModuleObject From 9dbfc68371d96ec06f706272262b507ca5b20d27 Mon Sep 17 00:00:00 2001 From: Josh Dearing Date: Wed, 21 May 2025 18:23:24 -0500 Subject: [PATCH 2/2] Updated validate.yml to use Powershell 7 --- .github/workflows/validate.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 51423aa..dec1480 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v1 - name: Install Prerequisites run: .\build\vsts-prerequisites.ps1 - shell: powershell + shell: pwsh - name: Validate run: .\build\vsts-validate.ps1 - shell: powershell \ No newline at end of file + shell: pwsh \ No newline at end of file