fix help function to not pipe to more if objects are returned instead of help text (#5395)

This commit is contained in:
Steve Lee
2017-11-09 16:21:49 -08:00
committed by Aditya Patwardhan
parent 8b42e1748e
commit e0ee555ad6
@@ -4258,10 +4258,20 @@ param(
$PSBoundParameters['Full'] = $true
}
#Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
# Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
$outputEncoding=[System.Console]::OutputEncoding
Get-Help @PSBoundParameters | more
$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')
{
$help
}
else
{
$help | more
}
";
}