Skip to content

Commit 562d3a1

Browse files
StartAutomatingStartAutomating
authored andcommitted
Join-PipeScript: Improving Unnamed end block behavior (Fixes #363)
1 parent abb48b5 commit 562d3a1

File tree

1 file changed

+56
-60
lines changed

1 file changed

+56
-60
lines changed

docs/ValidateScriptBlock.md

Lines changed: 56 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
11
ValidateScriptBlock
22
-------------------
3+
4+
5+
6+
37
### Synopsis
48
Validates Script Blocks
59

10+
11+
612
---
13+
14+
715
### Description
816

917
Validates Script Blocks for a number of common scenarios.
1018

19+
20+
1121
---
22+
23+
1224
### Examples
1325
#### EXAMPLE 1
1426
```PowerShell
@@ -43,7 +55,11 @@ $ScriptBlock
4355
```
4456
$ScriptBlock
4557
} | .>PipeScript
58+
59+
4660
---
61+
62+
4763
### Parameters
4864
#### **DataLanguage**
4965

@@ -52,205 +68,185 @@ This will attempt to recreate the Script Block as a datalanguage block and execu
5268

5369

5470

55-
> **Type**: ```[Switch]```
5671

57-
> **Required**: false
5872

59-
> **Position**: named
6073

61-
> **PipelineInput**:false
74+
|Type |Required|Position|PipelineInput|Aliases|
75+
|----------|--------|--------|-------------|-------|
76+
|`[Switch]`|false |named |false |Safe |
6277

6378

6479

65-
---
6680
#### **ParameterOnly**
6781

6882
If set, will ensure that the [ScriptBlock] only has parameters
6983

7084

7185

72-
> **Type**: ```[Switch]```
7386

74-
> **Required**: false
7587

76-
> **Position**: named
7788

78-
> **PipelineInput**:false
89+
|Type |Required|Position|PipelineInput|Aliases |
90+
|----------|--------|--------|-------------|--------------|
91+
|`[Switch]`|false |named |false |OnlyParameters|
7992

8093

8194

82-
---
8395
#### **NoBlock**
8496

8597
If set, will ensure that the [ScriptBlock] has no named blocks.
8698

8799

88100

89-
> **Type**: ```[Switch]```
90101

91-
> **Required**: false
92102

93-
> **Position**: named
94103

95-
> **PipelineInput**:false
104+
|Type |Required|Position|PipelineInput|Aliases |
105+
|----------|--------|--------|-------------|--------|
106+
|`[Switch]`|false |named |false |NoBlocks|
96107

97108

98109

99-
---
100110
#### **NoParameter**
101111

102112
If set, will ensure that the [ScriptBlock] has no parameters.
103113

104114

105115

106-
> **Type**: ```[Switch]```
107116

108-
> **Required**: false
109117

110-
> **Position**: named
111118

112-
> **PipelineInput**:false
119+
|Type |Required|Position|PipelineInput|Aliases |
120+
|----------|--------|--------|-------------|------------------------|
121+
|`[Switch]`|false |named |false |NoParameters<br/>NoParam|
113122

114123

115124

116-
---
117125
#### **IncludeCommand**
118126

119-
> **Type**: ```[Object]```
120127

121-
> **Required**: false
122128

123-
> **Position**: named
124129

125-
> **PipelineInput**:false
130+
|Type |Required|Position|PipelineInput|
131+
|----------|--------|--------|-------------|
132+
|`[Object]`|false |named |false |
126133

127134

128135

129-
---
130136
#### **ExcludeCommand**
131137

132-
> **Type**: ```[Object]```
133138

134-
> **Required**: false
135139

136-
> **Position**: named
137140

138-
> **PipelineInput**:false
141+
|Type |Required|Position|PipelineInput|
142+
|----------|--------|--------|-------------|
143+
|`[Object]`|false |named |false |
139144

140145

141146

142-
---
143147
#### **IncludeType**
144148

145149
If set, will ensure that the script block contains types in this list.
146150
Passing -IncludeType without -ExcludeType will make -ExcludeType default to *.
147151

148152

149153

150-
> **Type**: ```[Object]```
151154

152-
> **Required**: false
153155

154-
> **Position**: named
155156

156-
> **PipelineInput**:false
157+
|Type |Required|Position|PipelineInput|
158+
|----------|--------|--------|-------------|
159+
|`[Object]`|false |named |false |
157160

158161

159162

160-
---
161163
#### **ExcludeType**
162164

163165
If set, will ensure that the script block does not use the types in this list.
164166
Passing -IncludeType without -ExcludeType will make -ExcludeType default to *.
165167

166168

167169

168-
> **Type**: ```[Object]```
169170

170-
> **Required**: false
171171

172-
> **Position**: named
173172

174-
> **PipelineInput**:false
173+
|Type |Required|Position|PipelineInput|
174+
|----------|--------|--------|-------------|
175+
|`[Object]`|false |named |false |
175176

176177

177178

178-
---
179179
#### **NoLoop**
180180

181181
If set, will ensure that the ScriptBlock does not contain any loops.
182182

183183

184184

185-
> **Type**: ```[Switch]```
186185

187-
> **Required**: false
188186

189-
> **Position**: named
190187

191-
> **PipelineInput**:false
188+
|Type |Required|Position|PipelineInput|Aliases|
189+
|----------|--------|--------|-------------|-------|
190+
|`[Switch]`|false |named |false |NoLoops|
192191

193192

194193

195-
---
196194
#### **NoWhileLoop**
197195

198196
If set, will ensure that the ScriptBlock does not contain any do or while loops.
199197

200198

201199

202-
> **Type**: ```[Switch]```
203200

204-
> **Required**: false
205201

206-
> **Position**: named
207202

208-
> **PipelineInput**:false
203+
|Type |Required|Position|PipelineInput|Aliases |
204+
|----------|--------|--------|-------------|---------------------------------------|
205+
|`[Switch]`|false |named |false |NoWhileLoops<br/>NoDoLoops<br/>NoDoLoop|
209206

210207

211208

212-
---
213209
#### **AstCondition**
214210

215211
One or more AST conditions to validate.
216212
If no results are found or the condition throws, the script block will be considered invalid.
217213

218214

219215

220-
> **Type**: ```[ScriptBlock[]]```
221216

222-
> **Required**: false
223217

224-
> **Position**: named
225218

226-
> **PipelineInput**:false
219+
|Type |Required|Position|PipelineInput|Aliases |
220+
|-----------------|--------|--------|-------------|-----------------------|
221+
|`[ScriptBlock[]]`|false |named |false |AstConditions<br/>IfAst|
227222

228223

229224

230-
---
231225
#### **VariableAST**
232226

233227
A VariableExpression. If provided, the Validation attributes will apply to this variable.
234228

235229

236230

237-
> **Type**: ```[VariableExpressionAst]```
238231

239-
> **Required**: true
240232

241-
> **Position**: named
242233

243-
> **PipelineInput**:true (ByValue)
234+
|Type |Required|Position|PipelineInput |
235+
|-------------------------|--------|--------|--------------|
236+
|`[VariableExpressionAst]`|true |named |true (ByValue)|
237+
238+
244239

245240

246241

247242
---
243+
244+
248245
### Syntax
249246
```PowerShell
250247
ValidateScriptBlock [-DataLanguage] [-ParameterOnly] [-NoBlock] [-NoParameter] [-IncludeCommand <Object>] [-ExcludeCommand <Object>] [-IncludeType <Object>] [-ExcludeType <Object>] [-NoLoop] [-NoWhileLoop] [-AstCondition <ScriptBlock[]>] [<CommonParameters>]
251248
```
252249
```PowerShell
253250
ValidateScriptBlock [-DataLanguage] [-ParameterOnly] [-NoBlock] [-NoParameter] [-IncludeCommand <Object>] [-ExcludeCommand <Object>] [-IncludeType <Object>] [-ExcludeType <Object>] [-NoLoop] [-NoWhileLoop] [-AstCondition <ScriptBlock[]>] -VariableAST <VariableExpressionAst> [<CommonParameters>]
254251
```
255-
---
256252

0 commit comments

Comments
 (0)