Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4169,8 +4169,9 @@ .FORWARDHELPCATEGORY Cmdlet

$help = Get-Help @PSBoundParameters

# If a list of help is returned, don't pipe to more
if (($help | Select-Object -First 1).PSTypeNames -Contains 'HelpInfoShort')
# If a list of help is returned or AliasHelpInfo (because it is small), don't pipe to more
$psTypeNames = ($help | Select-Object -First 1).PSTypeNames
if ($psTypeNames -Contains 'HelpInfoShort' -Or $psTypeNames -Contains 'AliasHelpInfo')
{
$help
}
Expand Down
12 changes: 10 additions & 2 deletions test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
}

Describe "Get-Help should find pattern alias" -Tags "CI" {
# Remove test alias
BeforeAll {
Set-Alias -Name testAlias1 -Value Where-Object
}

AfterAll {
Remove-Item alias:\testAlias1 -ErrorAction SilentlyContinue
}
Expand All @@ -355,11 +358,16 @@ Describe "Get-Help should find pattern alias" -Tags "CI" {
}

It "Get-Help should find alias with * pattern" {
Set-Alias -Name testAlias1 -Value Where-Object
$help = Get-Help testAlias1*
$help.Category | Should -BeExactly "Alias"
$help.Synopsis | Should -BeExactly "Where-Object"
}

It "Help alias should be same as Get-Help alias" {
$help1 = Get-Help testAlias*
$help2 = help testAlias*
Compare-Object $help1 $help2 | Should -BeNullOrEmpty
}
}

Describe "help function uses full view by default" -Tags "CI" {
Expand Down