Skip to content

Commit fcead29

Browse files
authored
Correct pipeline acceptance docs for Invoke-Formatter.md (#1833)
1 parent 9d66016 commit fcead29

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Tests/Engine/ModuleHelp.Tests.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,25 @@ Describe 'Cmdlet parameter help' {
234234
# To avoid calling Trim method on a null object.
235235
$helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() }
236236
$helpType | Should -Be $codeType -Because "help for $commandName has correct parameter type for $parameterName"
237+
238+
foreach($parameterAttribute in $parameter.Attributes) {
239+
if ($parameterAttribute.ValueFromPipeline -eq $null) { continue }
240+
241+
$parameterHelpPipelineInput = if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') {
242+
$true
243+
}
244+
else {
245+
[System.Boolean]::Parse($parameterHelp.pipelineInput)
246+
}
247+
248+
$parameterHelpPipelineInput | Should -Be $parameterAttribute.ValueFromPipelineByPropertyName `
249+
-Because "Parameter $parameterName of command $CommandName and parameter set $($parameterAttribute.ParameterSetName) has correct ValueFromPipelineByPropertyName attribute"
250+
251+
if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') {
252+
$parameterAttribute.ValueFromPipeline | Should -BeTrue `
253+
-Because "Parameter $parameterName of command $CommandName and parameter set $($parameterAttribute.ParameterSetName) has correct ValueFromPipeline attribute"
254+
}
255+
}
237256
}
238257

239258
foreach ($helpParam in $HelpParameterNames) {

docs/Cmdlets/Invoke-Formatter.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Aliases:
104104
Required: False
105105
Position: 3
106106
Default value: None
107-
Accept pipeline input: False
107+
Accept pipeline input: True
108108
Accept wildcard characters: False
109109
```
110110
@@ -121,7 +121,7 @@ Aliases:
121121
Required: True
122122
Position: 1
123123
Default value: None
124-
Accept pipeline input: False
124+
Accept pipeline input: True (ByPropertyName, ByValue)
125125
Accept wildcard characters: False
126126
```
127127
@@ -137,7 +137,7 @@ Aliases:
137137
Required: False
138138
Position: 2
139139
Default value: CodeFormatting
140-
Accept pipeline input: False
140+
Accept pipeline input: True
141141
Accept wildcard characters: False
142142
```
143143

0 commit comments

Comments
 (0)