Skip to content

Commit

Permalink
Update FilterOutCommonParams function
Browse files Browse the repository at this point in the history
Use PSCmdlet Types to get common and optional parameters.

Signed-off-by: Gilbert Sanchez <[email protected]>
  • Loading branch information
HeyItsGilbert authored Oct 6, 2024
1 parent 0edda3e commit 8474860
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/Help.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
BeforeDiscovery {
function global:FilterOutCommonParams {
param ($Params)
$commonParams = @(
'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable',
'OutBuffer', 'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction',
'WarningVariable', 'Confirm', 'Whatif'
)
$commonParams = [System.Management.Automation.PSCmdlet]::OptionalCommonParameters +
[System.Management.Automation.PSCmdlet]::CommonParameters
$params | Where-Object { $_.Name -notin $commonParams } | Sort-Object -Property Name -Unique
}

Expand Down

0 comments on commit 8474860

Please sign in to comment.