Skip to content

Commit e13fedd

Browse files
committed
Remove ValueFromPipeline and Positional binding from ScriptDefinition parameter of Invoke-ScriptAnalyzer. Update documentation for pipeline input
1 parent de046c4 commit e13fedd

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

Engine/Commands/InvokeScriptAnalyzerCommand.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,13 @@ public string Path
6767
/// <summary>
6868
/// ScriptDefinition: a script definition in the form of a string to run rules on.
6969
/// </summary>
70-
[Parameter(Position = 0,
70+
[Parameter(
7171
ParameterSetName = ParameterSet_ScriptDefinition_IncludeSuppressed,
7272
Mandatory = true,
73-
ValueFromPipeline = true,
7473
ValueFromPipelineByPropertyName = true)]
75-
[Parameter(Position = 0,
74+
[Parameter(
7675
ParameterSetName = ParameterSet_ScriptDefinition_SuppressedOnly,
7776
Mandatory = true,
78-
ValueFromPipeline = true,
7977
ValueFromPipelineByPropertyName = true)]
8078
[ValidateNotNull]
8179
public string ScriptDefinition

Tests/Engine/ModuleHelp.Tests.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,9 @@ Describe 'Cmdlet parameter help' {
240240

241241
$parameterHelpPipelineInput = if ($parameterHelp.pipelineInput -eq 'True (ByPropertyName, ByValue)') {
242242
$true
243-
}
244-
else {
243+
} elseif ($parameterHelp.pipelineInput -eq 'True (ByPropertyName)') {
244+
$true
245+
} else {
245246
[System.Boolean]::Parse($parameterHelp.pipelineInput)
246247
}
247248

docs/Cmdlets/Invoke-ScriptAnalyzer.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,9 @@ Parameter Sets: ScriptDefinition_IncludeSuppressed, ScriptDefinition_SuppressedO
550550
Aliases:
551551
552552
Required: True
553-
Position: 0
553+
Position: Named
554554
Default value: None
555-
Accept pipeline input: True (ByPropertyName, ByValue)
555+
Accept pipeline input: True (ByPropertyName)
556556
Accept wildcard characters: False
557557
```
558558

@@ -687,9 +687,13 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
687687

688688
## INPUTS
689689

690-
### None
690+
### String
691+
692+
You can pipe a string representing a script path to this cmdlet. The string is bound to the `-Path` parameter by value.
693+
694+
### ScriptBlock
691695

692-
You cannot pipe input to this cmdlet.
696+
You can pipe a script block to this cmdlet. The script block is bound to the `-ScriptBlock` parameter by value.
693697

694698
## OUTPUTS
695699

0 commit comments

Comments
 (0)