Skip to content

Commit 07797f6

Browse files
StartAutomatingStartAutomating
authored andcommitted
Updating PipeScript.HelpOut.ps1 (#56)
1 parent aaa6ceb commit 07797f6

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

docs/ValidateTypes.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
2+
ValidateTypes
3+
-------------
4+
### Synopsis
5+
Validates if an object is one or more types.
6+
7+
---
8+
### Description
9+
10+
Validates if an object is one or more types.
11+
12+
This allows for a single parameter to handle multiple potential types.
13+
14+
---
15+
### Examples
16+
#### EXAMPLE 1
17+
```PowerShell
18+
{
19+
param(
20+
[ValidateTypes(TypeName="ScriptBlock","string")]
21+
$In
22+
)
23+
} | .>PipeScript
24+
```
25+
26+
#### EXAMPLE 2
27+
```PowerShell
28+
{"hello world"} |
29+
Invoke-PipeScript -ScriptBlock {
30+
param(
31+
[vfp()]
32+
[ValidateTypes(TypeName="ScriptBlock","string")]
33+
$In
34+
)
35+
```
36+
$In
37+
}
38+
#### EXAMPLE 3
39+
```PowerShell
40+
1 |
41+
Invoke-PipeScript -ScriptBlock {
42+
param(
43+
[vfp()]
44+
[ValidateTypes(TypeName="ScriptBlock","string")]
45+
$In
46+
)
47+
```
48+
$In
49+
}
50+
---
51+
### Parameters
52+
#### **TypeName**
53+
54+
The name of one or more types.
55+
Types can either be a .NET types of .PSTypenames
56+
TypeNames will be treated first as real types, then as exact matches, then as wildcards, and then as regular expressions.
57+
58+
59+
60+
|Type |Requried|Postion|PipelineInput|
61+
|----------------|--------|-------|-------------|
62+
|```[String[]]```|true |1 |false |
63+
---
64+
#### **VariableAST**
65+
66+
The variable that will be validated.
67+
68+
69+
70+
|Type |Requried|Postion|PipelineInput |
71+
|-----------------------------|--------|-------|--------------|
72+
|```[VariableExpressionAst]```|false |named |true (ByValue)|
73+
---
74+
### Syntax
75+
```PowerShell
76+
ValidateTypes [-TypeName] <String[]> [<CommonParameters>]
77+
```
78+
```PowerShell
79+
ValidateTypes [-TypeName] <String[]> [-VariableAST <VariableExpressionAst>] [<CommonParameters>]
80+
```
81+
---
82+
83+

0 commit comments

Comments
 (0)