GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Display full help with 'help' function (#5195) · PowerShell/PowerShell@c781959

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/System.Management.Automation/engine
    • InitialSessionState.cs
  • test/powershell/engine/Help
    • HelpSystem.Tests.ps1
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/System.Management.Automation/engine/InitialSessionState.cs‎

Copy file name to clipboardExpand all lines: src/System.Management.Automation/engine/InitialSessionState.cs
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4253,6 +4253,11 @@ .FORWARDHELPCATEGORY Cmdlet
42534253
[switch]
42544254
${ShowWindow})
42554255
4256+
# Display the full help topic by default but only for the AllUsersView parameter set.
4257+
if (($psCmdlet.ParameterSetName -eq 'AllUsersView') -and !$Full) {
4258+
$PSBoundParameters['Full'] = $true
4259+
}
4260+
42564261
#Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
42574262
$outputEncoding=[System.Console]::OutputEncoding
42584263
Collapse file

‎test/powershell/engine/Help/HelpSystem.Tests.ps1‎

Copy file name to clipboardExpand all lines: test/powershell/engine/Help/HelpSystem.Tests.ps1
+17-1Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
278278
}
279279
}
280280

281-
Describe "Get-Help should find pattern alias" -Tags "CI" {
281+
Describe "Get-Help should find pattern alias" -Tags "CI" {
282282
# Remove test alias
283283
AfterAll {
284284
Remove-Item alias:\testAlias1 -ErrorAction SilentlyContinue
@@ -300,5 +300,21 @@ Describe "Get-Help should find pattern help files" -Tags "CI" {
300300
$help.Category | Should BeExactly "Alias"
301301
$help.Synopsis | Should BeExactly "Where-Object"
302302
}
303+
}
304+
305+
Describe "help function uses full view by default" -Tags "CI" {
306+
It "help should return full view without -Full switch" {
307+
$gpsHelp = (help Microsoft.PowerShell.Management\Get-Process)
308+
$gpsHelp | Where-Object {$_ -cmatch '^PARAMETERS'} | Should Not BeNullOrEmpty
309+
}
303310

311+
It "help should return full view even with -Full switch" {
312+
$gpsHelp = (help Microsoft.PowerShell.Management\Get-Process -Full)
313+
$gpsHelp | Where-Object {$_ -cmatch '^PARAMETERS'} | Should Not BeNullOrEmpty
314+
}
315+
316+
It "help should not append -Full when not using AllUsersView parameter set" {
317+
$gpsHelp = (help Microsoft.PowerShell.Management\Get-Process -Parameter Name)
318+
$gpsHelp | Where-Object {$_ -cmatch '^PARAMETERS'} | Should BeNullOrEmpty
319+
}
304320
}

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.