Parameter Sets with 0.14.2
NoralK opened this issue · comments
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
I cannot seem to produce documentation, using PlatyPS 0.14.2 using 2.0 schema, that includes Parameter Sets.
I took this function from the PowerShell v5.1 documentation and placed it in a Module. The parameter sets show up in the ISE command sidebar as expected, but not in the popup help nor in the command-line Get-Help -Full
after generating the xml from PlatyPS and placing all the files in the correct locations. The syntax shows the four different syntaxes for the sets but the individual parameters do not have the Parameter set name
.
Am I missing something?
<#
.ExternalHelp Measure-Lines.psm1-help.xml
#>
function Measure-Lines {
[CmdletBinding(DefaultParameterSetName = 'Path')]
param (
[Parameter(Mandatory, ParameterSetName = 'Path', Position = 0)]
[Parameter(Mandatory, ParameterSetName = 'PathAll', Position = 0)]
[string[]]$Path,
[Parameter(Mandatory, ParameterSetName = 'LiteralPathAll', ValueFromPipeline)]
[Parameter(Mandatory, ParameterSetName = 'LiteralPath', ValueFromPipeline)]
[string[]]$LiteralPath,
[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetName = 'LiteralPath')]
[switch]$Lines,
[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetName = 'LiteralPath')]
[switch]$Words,
[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetName = 'LiteralPath')]
[switch]$Characters,
[Parameter(Mandatory, ParameterSetName = 'PathAll')]
[Parameter(Mandatory, ParameterSetName = 'LiteralPathAll')]
[switch]$All,
[Parameter(ParameterSetName = 'Path')]
[Parameter(ParameterSetName = 'PathAll')]
[switch]$Recurse
)
begin {
if ($All) {
$Lines = $Words = $Characters = $true
}
elseif (($Words -eq $false) -and ($Characters -eq $false)) {
$Lines = $true
}
}
process {
if ($Path) {
$Files = Get-ChildItem -Path $Path -Recurse:$Recurse -File
}
else {
$Files = Get-ChildItem -LiteralPath $LiteralPath -File
}
foreach ($file in $Files) {
$result = [ordered]@{ }
$result.Add('File', $file.fullname)
$content = Get-Content -LiteralPath $file.fullname
if ($Lines) { $result.Add('Lines', $content.Length) }
if ($Words) {
$wc = 0
foreach ($line in $content) { $wc += $line.split(' ').Length }
$result.Add('Words', $wc)
}
if ($Characters) {
$cc = 0
foreach ($line in $content) { $cc += $line.Length }
$result.Add('Characters', $cc)
}
New-Object -TypeName psobject -Property $result
}
}
}
Export-ModuleMember -Function *
This is from Format-SecureBootUEFI
, this is what I am expecting:
PARAMETERS
-Algorithm <string>
Required? true
Position? Named
Accept pipeline input? false
Parameter set name FormatForHashes
Aliases alg
Dynamic? false
-AppendWrite
Required? false
Position? Named
Accept pipeline input? false
Parameter set name FormatForHashes, FormatForCertificates
Aliases append
Dynamic? false
-CertificateFilePath <string[]>
Required? true
Position? Named
Accept pipeline input? false
Parameter set name FormatForCertificates
Aliases c
Dynamic? false
-ContentFilePath <string>
Required? false
Position? Named
Accept pipeline input? false
Parameter set name FormatForCertificates, FormatForHashes
Aliases f
Dynamic? false
-Delete
Required? true
Position? Named
Accept pipeline input? false
Parameter set name FormatForDelete
Aliases del
Dynamic? false
-FormatWithCert
Required? false
Position? Named
Accept pipeline input? false
Parameter set name FormatForCertificates
Aliases cert
Dynamic? false
-Hash <string[]>
Required? true
Position? Named
Accept pipeline input? false
Parameter set name FormatForHashes
Aliases h
Dynamic? false
-Name <string>
Required? true
Position? Named
Accept pipeline input? true (ByValue)
Parameter set name (All)
Aliases n
Dynamic? false
-SignableFilePath <string>
Required? false
Position? Named
Accept pipeline input? false
Parameter set name (All)
Aliases s
Dynamic? false
-SignatureOwner <guid>
Required? true
Position? Named
Accept pipeline input? false
Parameter set name FormatForCertificates, FormatForHashes
Aliases g
Dynamic? false
-Time <string>
Required? false
Position? Named
Accept pipeline input? false
Parameter set name (All)
Aliases t
Dynamic? false
Also, a side questions - is Dynamic parameters support in 0.14.2 - I believe the answer is no, just wanted to confirm that as well.
Cheers,
Noral
Expected behavior
Documentation created with Parameter Sets
Actual behavior
Documentation without Parameter Sets
Error details
No error.
Environment data
PlatyPS 0.14.2
PS 5.1
### Visuals
_No response_
PlatyPS does not support discovery of dynamic parameters. You can add them to the markdown manually, then they will show up in the MAML.
The issue with parameter set names is a bug in Get-Help
.