File tree Expand file tree Collapse file tree 1 file changed +78
-0
lines changed
Expand file tree Collapse file tree 1 file changed +78
-0
lines changed Original file line number Diff line number Diff line change 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+
You can’t perform that action at this time.
0 commit comments