Skip to content

Commit 3832680

Browse files
feat: Import-TypeView - Making format/view/control files ScriptMethods ( Fixes #231 )
1 parent feaa5dc commit 3832680

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Commands/Types.PS1XML/Import-TypeView.ps1

+3-4
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,8 @@
174174
# (this can simplify development of ScriptProperties, Methods, and other files).
175175
}
176176

177-
# Skip format/view files (this allows them to be in the same directory as types, if that is preferred)
178-
if ($item.Name -match '\.(?>format|view|control)\.ps1$') {
179-
continue
180-
}
177+
# Do not Skip format/view/control files (this allows them to be in the same directory as types, if that is preferred)
178+
$isFormatFile = $item.Name -match '\.(?>format|view|control)\.ps1$'
181179

182180
$itemName =
183181
$item.Name.Substring(0, $item.Name.Length - $item.Extension.Length)
@@ -193,6 +191,7 @@
193191
$isScript = $false
194192
}
195193

194+
# Skip empty scripts, since they will cause the .types.ps1xml to not load.
196195
if ($isScript -and -not ($scriptBlock -replace '\s')) {
197196
continue
198197
}

0 commit comments

Comments
 (0)