Skip to content

Commit 82e4042

Browse files
committed
PR feedback
1 parent f54e2ec commit 82e4042

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/PowerShellGet/private/functions/Validate-ModuleCommandAlreadyAvailable.ps1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ function Validate-ModuleCommandAlreadyAvailable
4646
if(-not $InstalledModuleInfo -or -not $InstalledModuleInfo.ModuleBase.StartsWith($InstallLocation, [System.StringComparison]::OrdinalIgnoreCase))
4747
{
4848
# Throw an error if there is a command with the same name from a different source.
49-
# Get-Command loads the module if a command is already available.
50-
# To avoid that, appending '*' at the end for each name then comparing the results.
5149
$CommandNames = $CurrentModuleInfo.ExportedCommands.Values.Name
5250

5351
# construct a hash with all of the commands in this module.
5452
$CommandNameHash = @{}
5553
$CommandNames | % { $CommandNameHash[$_] = 1 }
5654

57-
$AvailableCommands = Microsoft.PowerShell.Core\Get-Command -Name * `
55+
$AvailableCommands = Microsoft.PowerShell.Core\Get-Command `
5856
-ErrorAction Ignore `
5957
-WarningAction SilentlyContinue |
6058
Microsoft.PowerShell.Core\Where-Object { ($CommandNameHash.ContainsKey($_.Name)) -and

0 commit comments

Comments
 (0)