help function shouldn't use pager for AliasHelpInfo (#8552)

This commit is contained in:
Steve Lee 2019-01-07 13:39:57 -08:00 committed by Aditya Patwardhan
parent c188666305
commit d51b5fdc30
2 changed files with 13 additions and 4 deletions

View file

@ -4169,8 +4169,9 @@ param(
$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
}

View file

@ -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
}
@ -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" {