Add Aliases to the properties shown up when formatting the help content of the parameter returned by Get-Help (#20994)

This commit is contained in:
Dongbo Wang
2024-01-09 11:21:31 -08:00
committed by GitHub
parent 40dbbff35c
commit ac559185d0
2 changed files with 13 additions and 1 deletions
@@ -350,7 +350,7 @@ if (($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and
.AddNewline()
.AddText(HelpDisplayStrings.ParameterPosition)
.AddScriptBlockExpressionBinding(@" ", selectedByScript: @"($_.position -eq $()) -or ($_.position -eq '')", customControl: control7)
.AddScriptBlockExpressionBinding(@"$_.position", selectedByScript: "$_.position -ne $()")
.AddScriptBlockExpressionBinding(@"$_.position", selectedByScript: "$_.position -ne $()")
.AddNewline()
.AddText(HelpDisplayStrings.ParameterDefaultValue)
.AddPropertyExpressionBinding(@"defaultValue")
@@ -358,6 +358,9 @@ if (($_.relatedLinks -ne $()) -and ($_.relatedLinks.navigationLink -ne $()) -and
.AddText(HelpDisplayStrings.AcceptsPipelineInput)
.AddPropertyExpressionBinding(@"pipelineInput")
.AddNewline()
.AddText(HelpDisplayStrings.ParameterAliases)
.AddPropertyExpressionBinding(@"aliases")
.AddNewline()
.AddText(HelpDisplayStrings.AcceptsWildCardCharacters)
.AddPropertyExpressionBinding(@"globbing", customControl: MamlTrueFalseShortControl)
.AddNewline()
@@ -112,6 +112,15 @@ Describe "Validate that get-help works for CurrentUserScope" -Tags @('CI') {
$help.Description | Out-String | Should -Match $cmdletName
$help.Examples | Out-String | Should -Match $cmdletName
}
It "Validate 'Aliases' is present in help content formatting" {
## The parameter help content should be formatted with the following section:
## Accept pipeline input? xxxx
## Aliases NoOverwrite
## Accept wildcard characters? xxxx
$output = Get-Help Import-Module -Parameter NoClobber | Out-String
$output | Should -Match "Accept pipeline input\?.*\n\s+Aliases\s+NoOverwrite.*\n\s+Accept wildcard characters\?.*"
}
}
}