When I add a help section to my script, the Get-Help
cmdlet displays a different syntax. Here is a MWE:
#Require -Version 4.0
function global:Test-Syntax {
<#
.Synopsis
Cmdlet tests ValidateSet
#>
[CmdletBinding()]
# parameter check
param (
[ValidateSet("one", "two", "three")]
[string]$testparam
)
Write-Verbose "`$testparam: $testparam"
}
Get-Help Test-Syntax
shows the following in syntax section:
SYNTAX
Test-Syntax [[-testparam] <String>] [<CommonParameters>]
After I remove .Synopsis
or the whole help section, I receive the following from Get-Help
:
SYNTAX
Test-Syntax [[-testparam] <string> {one | two | three}] [<CommonParameters>]
I would like to have the second one, because a user directly get the information about the validated set. How can I get this help with a defined .Synopsis
?