Fix reading/writing syntax parameters in Maml help#821
Open
teramako wants to merge 12 commits intoPowerShell:mainfrom
Open
Fix reading/writing syntax parameters in Maml help#821teramako wants to merge 12 commits intoPowerShell:mainfrom
teramako wants to merge 12 commits intoPowerShell:mainfrom
Conversation
Fix following issues: MamlWriter: - generates syntax parameters as wrong order. The order should be positional parameters, mandatory parameters, and others MamlReader: - PowerShell#816 - Read `position` attribute correctly. And treat the parameter is positional or not. - Read `<command:parameterValue>` correctly as ParameterType. (if `<command:parameterValue>` is not defined, read '<dev:type>`) And treat the type is SwitchParameter or not. - PowerShell#815 - Fixed problem that `Parameter` instances are registered as duplicately
- Remove property: `Model.SyntaxItem.PositionalParameterKeys` - Remove field: `Model.SyntaxItem._positionalParameters` - Remove field: `Model.SyntaxItem._requiredParameters` - Remove method: `GetParametersInOrder()`
- Remove codes related `SyntaxItem.Parameters`. Because all of these are no longer needed for syntax generation. - Remove `SyntaxItem._parameterNames` - Remove `SyntaxItem._alphabeticOrderParameters` - Remove `SyntaxItem.Parameters` - Remove `SyntaxItem.ParameterNames` - Remove `SyntaxItem.AddParameter()` - Added code to reset `SyntaxItem.HasCmdletBinding` value to `CommandHelp.HasCmdletBinding` when loading Markdown. This is the same behavior as when loading Yaml. - Fix tests: Since `SyntaxItem.ParameterNames` has been removed, differences in `CommandHelp.Syntax.ParameterNames` are no longer reported.
…eter If the parameter is a SwitchParameter, skip rendering the <command:parameterValue> element. Instead, use the <dev:type> element to represent the formal parameter type. This change will result in the following changes in the help display SYNTAX: ... `[-Confirm <SwichParameter>]` -> ... `[-Confirm]` PARAMETERS: `-Confirm [<System.Management.Automation.SwitchParameter>]` -> `-Confirm`
outputs XML like the following:
```xml
<command:parameter attrs="...">
<!-- ... -->
<command:parameterValueGroup>
<command:parameterValue required="false" variableLength="false">Accepted Value 1</command:parameterValue>
<command:parameterValue required="false" variableLength="false">Accepted Value 2</command:parameterValue>
</command:parameterValueGroup>
</command:parameter>
```
…ue` always.
This affects to Help display.
Before:
```
PARAMETERS:
NAME [<Type>]
```
After:
```
PARAMETERS:
NAME <Type>
```
Author
Update 2025-09-14New features:
Bug fixes:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
This patch fixes a problem with reading and writing syntax parameters in the Maml help.
Fix following issues:
(The order of syntax parameters should be: positional parameters, required parameters, others in that order.)
Additionaly, removed no longer needed codes.
PR Context
To fix following issues: