PowerShell / platyPS

Write PowerShell External Help in Markdown
MIT License
778 stars 152 forks source link

Merge multiple YAML blocks for parameter metadata into one YAML block #571

Closed sdwheeler closed 5 months ago

sdwheeler commented 2 years ago

Summary of the new feature / enhancement

When a parameter belongs to multiple parameter sets, the current version of PlatyPS creates multiple YAML blocks when the parameter has different metadata in different parameter sets.

For example, a parameter can be required in one set and optional in another. Rather than have separate YAML blocks, create a single YAML block with the aggregated information.

Here is an example from Invoke-Command for -ApplicationName:

Type: System.String
Parameter Sets: FilePathComputerName, ComputerName
Aliases:

Required: False
Position: Named
Default value: $PSSessionApplicationName if set on the local computer, otherwise WSMAN
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

Here is an example for -Credential

Type: System.Management.Automation.PSCredential
Parameter Sets: ComputerName, FilePathComputerName, Uri, FilePathUri, VMId, VMName, FilePathVMId, FilePathVMName
Aliases:

Required: True (VMId, VMName, FilePathVMId, FilePathVMName), False (ComputerName, FilePathComputerName, Uri, FilePathUri)
Position: Named
Default value: Current user
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

The Parameters Sets: metadata should list all sets that the parameter belongs to. The Required: metdata should list the sets where is is true and where it is false. If it is true or false for all sets in Parameter sets: then just list the boolean value.

Also note that Accept pipeline input: should list the type of pipeline input (ByValue or ByPropertyName).

Proposed technical implementation details (optional)

No response

theJasonHelmick commented 5 months ago

This is included in the Microsoft.PowerShell.PlatyPS 1.0 release.