File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,13 @@ $Parameter = @{},
7777# An argument list.
7878[Alias (' Args' )]
7979[PSObject []]
80- $ArgumentList = @ ()
80+ $ArgumentList = @ (),
81+
82+ # Some languages only allow single-line comments.
83+ # To work with these languages, provide a -LinePattern indicating what makes a comment
84+ # Only lines beginning with this pattern within -StartPattern and -EndPattern will be considered a script.
85+ [Regex ]
86+ $LinePattern
8187)
8288
8389begin {
@@ -93,6 +99,11 @@ begin {
9399 return
94100 }
95101
102+ if ($LinePattern ) {
103+ $pipeScriptLines = @ ($pipeScriptText -split ' (?>\r\n|\n)' )
104+ $pipeScriptText = $pipeScriptLines -match $LinePattern -replace $LinePattern -join [Environment ]::Newline
105+ }
106+
96107 $InlineScriptBlock = [scriptblock ]::Create($pipeScriptText )
97108 if (-not $InlineScriptBlock ) {
98109 return
You can’t perform that action at this time.
0 commit comments