mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Display full help with 'help' function (#5195)
Display full help with 'help' function
This commit is contained in:
committed by
Aditya Patwardhan
parent
2670917981
commit
c781959232
@@ -4253,6 +4253,11 @@ param(
|
||||
[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
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user