Skip to content

Commit 2bc1d05

Browse files
author
James Brundage
committed
Update-PipeScript: Adding -RegionReplacement and Examples (Fixes #179)
1 parent fa5b078 commit 2bc1d05

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Update-PipeScript.ps1

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,20 @@ function Update-PipeScript {
77
88
Update-PipeScript is used by PipeScript transpilers in order to make a number of changes to a script.
99
10-
It can also be used interactively to transform scripts or text in a number of ways.
10+
It can also be used interactively to transform scripts or text in a number of ways.
11+
.EXAMPLE
12+
Update-PipeScript -ScriptBlock {
13+
param($x,$y)
14+
} -RemoveParameter x
15+
.EXAMPLE
16+
Update-PipeScript -RenameVariable @{x='y'} -ScriptBlock {$x}
17+
.EXAMPLE
18+
Update-PipeScript -ScriptBlock {
19+
#region MyRegion
20+
1
21+
#endregion MyRegion
22+
2
23+
} -RegionReplacement @{MyRegion=''}
1124
#>
1225
[Alias('Update-ScriptBlock', 'ups')]
1326
param(
@@ -266,7 +279,7 @@ function Update-PipeScript {
266279

267280
if ($RegionReplacement.Count) {
268281
foreach ($regionName in $RegionReplacement.Keys) {
269-
$replacementReplacer = $RegexReplacement[$regionName]
282+
$replacementReplacer = $RegionReplacement[$regionName]
270283
$RegionName = $RegionName -replace '\s', '\s'
271284

272285
$regionReplaceRegex = [Regex]::New("

0 commit comments

Comments
 (0)