platyPS
platyPS copied to clipboard
Maintain parameter order
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:
How can I ensure that the external help file will match the markdown? Running in Windows PowerShell with the latest Platyps release.
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.
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
.
This is fixed in Microsoft.PowerShell.PlatyPS v1.