We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 05a03e4 commit 6bd8284Copy full SHA for 6bd8284
Transpilers/Keywords/New.psx.ps1
@@ -38,6 +38,7 @@
38
$CommandAst = $_
39
return ($commandAst -and $CommandAst.CommandElements[0].Value -eq 'new')
40
})]
41
+[Reflection.AssemblyMetadata("PipeScript.Keyword",$true)]
42
param(
43
[Parameter(Mandatory,ValueFromPipeline)]
44
[Management.Automation.Language.CommandAst]
@@ -164,8 +165,15 @@ process {
164
165
$newNew = "`$($newNew)"
166
}
167
168
+
169
if ($newNew) {
- [scriptblock]::Create($newNew)
170
+ if ($CommandAst.IsPiped) {
171
+ [scriptblock]::create(". { process {
172
+$newNew
173
+ } }")
174
+ } else {
175
+ [scriptblock]::Create($newNew)
176
+ }
177
} else {
178
Write-Error "Unable to create '$newTypeName'"
179
return
0 commit comments