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 @@ -4253,6 +4253,11 @@ .FORWARDHELPCATEGORY Cmdlet
[switch]
${ShowWindow})

# Display the full help topic by default but only for the AllUsersView parameter set.
if (($psCmdlet.ParameterSetName -eq 'AllUsersView') -and !$Full) {
$PSBoundParameters['Full'] = $true
}

#Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
$outputEncoding=[System.Console]::OutputEncoding

Expand Down
18 changes: 17 additions & 1 deletion test/powershell/engine/Help/HelpSystem.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
}
}

Describe "Get-Help should find pattern alias" -Tags "CI" {
Describe "Get-Help should find pattern alias" -Tags "CI" {
# Remove test alias
AfterAll {
Remove-Item alias:\testAlias1 -ErrorAction SilentlyContinue
Expand All @@ -300,5 +300,21 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
$help.Category | Should BeExactly "Alias"
$help.Synopsis | Should BeExactly "Where-Object"
}
}

Describe "help function uses full view by default" -Tags "CI" {
It "help should return full view without -Full switch" {
$gpsHelp = (help Microsoft.PowerShell.Management\Get-Process)
$gpsHelp | Where-Object {$_ -cmatch '^PARAMETERS'} | Should Not BeNullOrEmpty
}

It "help should return full view even with -Full switch" {
$gpsHelp = (help Microsoft.PowerShell.Management\Get-Process -Full)
$gpsHelp | Where-Object {$_ -cmatch '^PARAMETERS'} | Should Not BeNullOrEmpty
}

It "help should not append -Full when not using AllUsersView parameter set" {
$gpsHelp = (help Microsoft.PowerShell.Management\Get-Process -Parameter Name)
$gpsHelp | Where-Object {$_ -cmatch '^PARAMETERS'} | Should BeNullOrEmpty
}
}