platyPS icon indicating copy to clipboard operation
platyPS copied to clipboard

External Help File is not showing Default Parameter Sets Syntax

Open arunswarnam opened this issue 6 years ago • 4 comments

The external help doesn't show all possible Cmdlet invocation syntax's. I guess it is missing to recognize the DefaultParamSet (shown below). Steps to reproduce

[Cmdlet("Start", "PS", DefaultParameterSetName = DefaultParamSet)]
    public class PSTest:PSCmdlet
    {
        [Parameter(Mandatory = false,ValueFromPipelineByPropertyName =true)]
        public string Cid { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = ResponseParamSet)]
        public SwitchParameter Response { get; set; }

        [Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, ParameterSetName = StatusParamSet)]
        public string Wait { get; set; }

        [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, ParameterSetName = StatusParamSet)]
        public int MaxAttempt { get; set; }

        protected override void ProcessRecord()
        {
            Console.WriteLine(ParameterSetName);
        }

        private const string StatusParamSet = "Status";
        private const string DefaultParamSet = "Default";
        private const string ResponseParamSet = "Response";
    }

Compile this class and generate a binary Powershell module and generate external help file using platyPS.

New-MarkdownHelp -Module cmdletparamset -OutputFolder ./Docs
New-ExternalHelp -Path ./Docs/ -OutputPath ./Help/

Expected behavior

The external help file has to show three syntax items (MAML Nodes) like what is shown in the Markdown help file

SYNTAX

Default (Default)

Start-PS [-Cid <String>] [<CommonParameters>]

Response

Start-PS [-Cid <String>] [-Response] [<CommonParameters>]

Status

Start-PS [-Cid <String>] -Wait <String> [-MaxAttempt <Int32>] [<CommonParameters>]

Actual behavior

    <command:syntax>
      <command:syntaxItem>
        <maml:name>Start-PS</maml:name>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none">
          <maml:name>Cid</maml:name>
          <maml:Description>
            <maml:para>{{ Fill Cid Description }}</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none">
          <maml:name>MaxAttempt</maml:name>
          <maml:Description>
            <maml:para>{{ Fill MaxAttempt Description }}</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">Int32</command:parameterValue>
          <dev:type>
            <maml:name>Int32</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none">
          <maml:name>Wait</maml:name>
          <maml:Description>
            <maml:para>{{ Fill Wait Description }}</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
      <command:syntaxItem>
        <maml:name>Start-PS</maml:name>
        <command:parameter required="false" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none">
          <maml:name>Cid</maml:name>
          <maml:Description>
            <maml:para>{{ Fill Cid Description }}</maml:para>
          </maml:Description>
          <command:parameterValue required="true" variableLength="false">String</command:parameterValue>
          <dev:type>
            <maml:name>String</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>None</dev:defaultValue>
        </command:parameter>
        <command:parameter required="true" variableLength="true" globbing="false" pipelineInput="True (ByPropertyName)" position="named" aliases="none">
          <maml:name>Response</maml:name>
          <maml:Description>
            <maml:para>{{ Fill Response Description }}</maml:para>
          </maml:Description>
          <dev:type>
            <maml:name>SwitchParameter</maml:name>
            <maml:uri />
          </dev:type>
          <dev:defaultValue>False</dev:defaultValue>
        </command:parameter>
      </command:syntaxItem>
    </command:syntax>

Environment data

Name Value


PSVersion 6.2.4 PSEdition Core GitCommitId 6.2.4 OS Darwin 18.7.0 Darwin Kernel Version 18.7.0: Mon Apr 27 20:09:39 PDT 2020; root:xnu-4903.278.35~1/RELEASE_X86_64 Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

arunswarnam avatar Jun 18 '20 22:06 arunswarnam

@vors It will be good to get your feedback on the above issue we are facing. The generated MD file has Syntax showing all the invocations but the MAML file doesn't show all of them.

viralmodi avatar Jun 24 '20 19:06 viralmodi

@adityapatwardhan @jongeller Any response to the above?

viralmodi avatar Jul 20 '20 08:07 viralmodi

@viralmodi - Thanks for reporting this issue. I've added to our backlog for review after our 2.0 release.

theJasonHelmick avatar Jul 26 '21 17:07 theJasonHelmick

Haven't been able to reproduce. If you can attach the markdown produced by New-MarkdownHelp we can reopen this issue for investigation.

sdwheeler avatar Apr 04 '22 21:04 sdwheeler