File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ ValueFromPipline Shorthand
4+ . DESCRIPTION
5+ This is syntax shorthand to create [Parameter] attributes that take ValueFromPipelineByPropertyName.
6+ #>
7+ [Alias (' VFPBPN' )]
8+ param (
9+ [Alias (' ParameterSetName' )]
10+ [string ]
11+ $ParameterSet ,
12+
13+ [switch ]
14+ $Mandatory ,
15+
16+ [Alias (' VFP' )]
17+ [switch ]
18+ $ValueFromPipeline
19+ )
20+
21+ $paramOptions = @ (
22+ if ($Mandatory ) {
23+ " Mandatory"
24+ }
25+ if ($ParameterSet ) {
26+ " ParameterSetName='$ ( $ParameterSet.Replace (" '" , " ''" )) '"
27+ }
28+ " ValueFromPipelineByPropertyName"
29+ if ($ValueFromPipeline ) {
30+ " ValueFromPipeline"
31+ }
32+ if ($PSBoundParameters.ContainsKey (' Position' )) {
33+ " Position=$position "
34+ }
35+ ) -join ' ,'
36+
37+ $nsb = [ScriptBlock ]::Create(
38+ " [Parameter($paramOptions )]param()"
39+ )
40+
41+ $nsb
You can’t perform that action at this time.
0 commit comments