Skip to content

Commit

Permalink
feat: Import-TypeView - Making format/view/control files ScriptMethod…
Browse files Browse the repository at this point in the history
…s ( Fixes #231 )
  • Loading branch information
StartAutomating committed Jul 7, 2024
1 parent feaa5dc commit 3832680
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Commands/Types.PS1XML/Import-TypeView.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,8 @@
# (this can simplify development of ScriptProperties, Methods, and other files).
}

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

$itemName =
$item.Name.Substring(0, $item.Name.Length - $item.Extension.Length)
Expand All @@ -193,6 +191,7 @@
$isScript = $false
}

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

0 comments on commit 3832680

Please sign in to comment.