platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

Maintain parameter order

Open jdhitsolutions opened this issue 4 years ago • 2 comments

This is an annoying problem that I find in several files. My markdown file will show a syntax like this:

Install-PowerShell [[-Path] <String>] [-EnableRemoting] [-EnableContextMenu]
[-EnableRunContext] [[-Mode] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]

But, when I generate the external help and look that the command I see this: image

How can I ensure that the external help file will match the markdown? Running in Windows PowerShell with the latest Platyps release.

jdhitsolutions avatar Jan 13 '21 17:01 jdhitsolutions

After additional testing and experimentation, it appears that the order of parameters in the markdown under ##PARAMETERS will be applied to the syntax in the generated MAML. Part of the challenge is that as parameters are added and the markdown updated, you can end up with a jumbled syntax.

jdhitsolutions avatar Jan 14 '21 00:01 jdhitsolutions

The goal we are working on is that the syntax order should be the reflected order. The order under ## PARAMETERS should be independent. It will default to reflected order unless you use -AlphabeticParamsOrder.

sdwheeler avatar Jan 15 '21 16:01 sdwheeler

This is fixed in Microsoft.PowerShell.PlatyPS v1.

sdwheeler avatar May 31 '24 17:05 sdwheeler