From fcead292098d301399c1c2fb9507efffbbc5b3ea Mon Sep 17 00:00:00 2001 From: Christoph Bergmeister Date: Tue, 30 Aug 2022 23:01:09 +0100 Subject: [PATCH] Correct pipeline acceptance docs for Invoke-Formatter.md (#1833) --- Tests/Engine/ModuleHelp.Tests.ps1 | 19 +++++++++++++++++++ docs/Cmdlets/Invoke-Formatter.md | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Tests/Engine/ModuleHelp.Tests.ps1 b/Tests/Engine/ModuleHelp.Tests.ps1 index 39ff83f2b..e2dbea8c4 100644 --- a/Tests/Engine/ModuleHelp.Tests.ps1 +++ b/Tests/Engine/ModuleHelp.Tests.ps1 @@ -234,6 +234,25 @@ Describe 'Cmdlet parameter help' { # To avoid calling Trim method on a null object. $helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() } $helpType | Should -Be $codeType -Because "help for $commandName has correct parameter type for $parameterName" + + foreach($parameterAttribute in $parameter.Attributes) { + if ($parameterAttribute.ValueFromPipeline -eq $null) { continue } + + $parameterHelpPipelineInput = if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') { + $true + } + else { + [System.Boolean]::Parse($parameterHelp.pipelineInput) + } + + $parameterHelpPipelineInput | Should -Be $parameterAttribute.ValueFromPipelineByPropertyName ` + -Because "Parameter $parameterName of command $CommandName and parameter set $($parameterAttribute.ParameterSetName) has correct ValueFromPipelineByPropertyName attribute" + + if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') { + $parameterAttribute.ValueFromPipeline | Should -BeTrue ` + -Because "Parameter $parameterName of command $CommandName and parameter set $($parameterAttribute.ParameterSetName) has correct ValueFromPipeline attribute" + } + } } foreach ($helpParam in $HelpParameterNames) { diff --git a/docs/Cmdlets/Invoke-Formatter.md b/docs/Cmdlets/Invoke-Formatter.md index e88f5f2c8..6e4b3a642 100644 --- a/docs/Cmdlets/Invoke-Formatter.md +++ b/docs/Cmdlets/Invoke-Formatter.md @@ -104,7 +104,7 @@ Aliases: Required: False Position: 3 Default value: None -Accept pipeline input: False +Accept pipeline input: True Accept wildcard characters: False ``` @@ -121,7 +121,7 @@ Aliases: Required: True Position: 1 Default value: None -Accept pipeline input: False +Accept pipeline input: True (ByPropertyName, ByValue) Accept wildcard characters: False ``` @@ -137,7 +137,7 @@ Aliases: Required: False Position: 2 Default value: CodeFormatting -Accept pipeline input: False +Accept pipeline input: True Accept wildcard characters: False ```