Skip to content

Commit 127d786

Browse files
author
James Brundage
committed
Adding RenameVariable Transpiler (#160)
1 parent 65c8847 commit 127d786

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Transpilers/RenameVariable.psx.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<#
2+
.SYNOPSIS
3+
Renames variables
4+
.DESCRIPTION
5+
Renames variables in a ScriptBlock
6+
.EXAMPLE
7+
{
8+
[RenameVariable(VariableRename={
9+
@{
10+
x='x1'
11+
y='y1'
12+
}
13+
})]
14+
param($x, $y)
15+
} | .>PipeScript
16+
.LINK
17+
Update-PipeScript
18+
#>
19+
param(
20+
# The name of one or more parameters to remove
21+
[Parameter(Mandatory,Position=0)]
22+
[Alias('Variables','RenameVariables', 'RenameVariable','VariableRenames')]
23+
[Collections.IDictionary]
24+
$VariableRename,
25+
26+
# The ScriptBlock that declares the parameters.
27+
[Parameter(Mandatory,ValueFromPipeline)]
28+
[scriptblock]
29+
$ScriptBlock
30+
)
31+
32+
process {
33+
Update-PipeScript -ScriptBlock $ScriptBlock -RenameVariable $VariableRename
34+
}
35+

0 commit comments

Comments
 (0)