Skip to content

Commit 98bccd7

Browse files
StartAutomatingStartAutomating
authored andcommitted
Updating PipeScript.HelpOut.ps1 (#56)
1 parent 839824f commit 98bccd7

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

docs/ValidateExtension.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
2+
ValidateExtension
3+
-----------------
4+
### Synopsis
5+
Validates Extensions
6+
7+
---
8+
### Description
9+
10+
Validates that a parameter or object has one or more extensions.
11+
12+
This creates a [ValidatePattern] that will ensure the extension matches.
13+
14+
---
15+
### Examples
16+
#### EXAMPLE 1
17+
```PowerShell
18+
{
19+
param(
20+
[ValidateExtension(Extension=".cs", ".ps1")]
21+
$FilePath
22+
)
23+
} |.>PipeScript
24+
```
25+
26+
#### EXAMPLE 2
27+
```PowerShell
28+
{
29+
param(
30+
[ValidateExtension(Extension=".cs", ".ps1")]
31+
$FilePath
32+
)
33+
```
34+
$FilePath
35+
} -Parameter @{FilePath=".ps1"}
36+
#### EXAMPLE 3
37+
```PowerShell
38+
{
39+
param(
40+
[ValidateExtension(Extension=".cs", ".ps1")]
41+
$FilePath
42+
)
43+
```
44+
$FilePath
45+
} -Parameter @{FilePath="foo.txt"}
46+
---
47+
### Parameters
48+
#### **Extension**
49+
50+
The extensions being validated.
51+
52+
53+
54+
|Type |Requried|Postion|PipelineInput|
55+
|----------------|--------|-------|-------------|
56+
|```[String[]]```|true |1 |false |
57+
---
58+
#### **VariableAST**
59+
60+
A variable expression.
61+
If this is provided, will apply a ```[ValidatePattern({})]``` attribute to the variable, constraining future values.
62+
63+
64+
65+
|Type |Requried|Postion|PipelineInput |
66+
|-----------------------------|--------|-------|--------------|
67+
|```[VariableExpressionAst]```|false |named |true (ByValue)|
68+
---
69+
### Syntax
70+
```PowerShell
71+
ValidateExtension [-Extension] <String[]> [<CommonParameters>]
72+
```
73+
```PowerShell
74+
ValidateExtension [-Extension] <String[]> [-VariableAST <VariableExpressionAst>] [<CommonParameters>]
75+
```
76+
---
77+
78+

0 commit comments

Comments
 (0)