File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1818 $FilePath ,
1919
2020 # If set, will generate an identical typeview for the deserialized form of each typename.
21+ [Parameter (ValueFromPipelineByPropertyName )]
2122 [switch ]$Deserialized ,
2223
24+ # The namespace to use for all imported types.
25+ # This will be prepended to the type name, and followed by a period.
26+ [Parameter (ValueFromPipelineByPropertyName )]
27+ [Alias (' Prefix' )]
28+ [string ]$Namespace ,
29+
2330 # Any file paths to exclude.
2431 [Parameter (ValueFromPipelineByPropertyName )]
2532 [SupportsWildcards ()]
129136
130137 :nextMember foreach ($mt in $membersByType.GetEnumerator () | Sort-Object Key) { # Walk thru the members by type
131138 $WriteTypeViewSplat = @ { # and create a hashtable to splat.
132- TypeName = $ mt.Key
139+ TypeName = if ( $Namespace ) { " $Namespace . $ ( $ mt.Key ) " } else { $mt .Key }
133140 Deserialized = $Deserialized
134141 }
142+ $OriginalParameterCount = $WriteTypeViewSplat.Count
135143 # Then, sort the values by name and by if it comes from this directory.
136144 $sortedValues = $mt.Value | Sort-Object Name, { $_.Directory.Name -ne $mt.Key }
137145
@@ -484,7 +492,8 @@ $stream.Dispose()
484492 $WriteTypeViewSplat.EventName = $eventNames
485493 }
486494
487- if ($WriteTypeViewSplat.Count -gt 1 ) {
495+ # If we have added any parameters to splat, we will write the type view.
496+ if ($WriteTypeViewSplat.Count -gt $OriginalParameterCount ) {
488497 $WriteTypeViewSplat.HideProperty = $hideProperty
489498 Write-TypeView @WriteTypeViewSplat
490499 }
You can’t perform that action at this time.
0 commit comments