Example #1
0
 /// <summary>
 /// Generates the <em>&lt;command:syntaxItem&gt;</em> element for a specific parameter set of a command.
 /// </summary>
 /// <param name="commentReader">Provides access to the XML Doc comments.</param>
 /// <param name="command">The command.</param>
 /// <param name="parameterSetName">The parameter set name.</param>
 /// <param name="reportWarning">Function used to log warnings.</param>
 /// <returns>A <em>&lt;command:syntaxItem&gt;</em> element for the specific <paramref name="parameterSetName"/> of the <paramref name="command"/>.</returns>
 private XElement GenerateSyntaxItemElement(ICommentReader commentReader, Command command, string parameterSetName, ReportWarning reportWarning)
 {
     var syntaxItemElement = new XElement(commandNs + "syntaxItem",
                                          new XElement(mamlNs + "name", command.Name));
     foreach (var parameter in command.GetParameters(parameterSetName))
     {
         syntaxItemElement.Add(GenerateComment("Parameter: " + parameter.Name));
         syntaxItemElement.Add(GenerateParameterElement(commentReader, parameter, parameterSetName, reportWarning));
     }
     return syntaxItemElement;
 }
Example #2
0
 /// <summary>
 /// Generates the <em>&lt;command:inputTypes&gt;</em> element for a command.
 /// </summary>
 /// <param name="commentReader">Provides access to the XML Doc comments.</param>
 /// <param name="command">The command.</param>
 /// <param name="reportWarning">Function used to log warnings.</param>
 /// <returns>A <em>&lt;command:inputTypes&gt;</em> element for the <paramref name="command"/>.</returns>
 private XElement GenerateInputTypesElement(ICommentReader commentReader, Command command, ReportWarning reportWarning)
 {
     var inputTypesElement = new XElement(commandNs + "inputTypes");
     var pipelineParameters = command.GetParameters(ParameterAttribute.AllParameterSets)
                                     .Where(p => p.IsPipeline(ParameterAttribute.AllParameterSets));
     foreach (var parameter in pipelineParameters)
     {
         inputTypesElement.Add(GenerateInputTypeElement(commentReader, parameter, reportWarning));
     }
     return inputTypesElement;
 }
Example #3
0
 /// <summary>
 /// Generates the <em>&lt;command:syntaxItem&gt;</em> element for a specific parameter set of a command.
 /// </summary>
 /// <param name="commentReader">Provides access to the XML Doc comments.</param>
 /// <param name="command">The command.</param>
 /// <param name="parameterSetName">The parameter set name.</param>
 /// <param name="reportWarning">Function used to log warnings.</param>
 /// <returns>A <em>&lt;command:syntaxItem&gt;</em> element for the specific <paramref name="parameterSetName"/> of the <paramref name="command"/>.</returns>
 private XElement GenerateSyntaxItemElement(ICommentReader commentReader, Command command, string parameterSetName, ReportWarning reportWarning)
 {
     var syntaxItemElement = new XElement(CommandNs + "syntaxItem",
                                          new XElement(MamlNs + "name", command.Name));
     foreach (var parameter in command.GetParameters(parameterSetName).OrderBy(p => p.GetPosition(parameterSetName)).
                                                                       ThenBy(p => p.IsRequired(parameterSetName) ? "0" : "1").
                                                                       ThenBy(p => p.Name))
     {
         syntaxItemElement.Add(GenerateComment("Parameter: " + parameter.Name));
         syntaxItemElement.Add(GenerateParameterElement(commentReader, parameter, parameterSetName, reportWarning));
     }
     return syntaxItemElement;
 }