File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 18
18
$FilePath ,
19
19
20
20
# If set, will generate an identical typeview for the deserialized form of each typename.
21
+ [Parameter (ValueFromPipelineByPropertyName )]
21
22
[switch ]$Deserialized ,
22
23
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
+
23
30
# Any file paths to exclude.
24
31
[Parameter (ValueFromPipelineByPropertyName )]
25
32
[SupportsWildcards ()]
129
136
130
137
:nextMember foreach ($mt in $membersByType.GetEnumerator () | Sort-Object Key) { # Walk thru the members by type
131
138
$WriteTypeViewSplat = @ { # and create a hashtable to splat.
132
- TypeName = $ mt.Key
139
+ TypeName = if ( $Namespace ) { " $Namespace . $ ( $ mt.Key ) " } else { $mt .Key }
133
140
Deserialized = $Deserialized
134
141
}
142
+ $OriginalParameterCount = $WriteTypeViewSplat.Count
135
143
# Then, sort the values by name and by if it comes from this directory.
136
144
$sortedValues = $mt.Value | Sort-Object Name, { $_.Directory.Name -ne $mt.Key }
137
145
@@ -484,7 +492,8 @@ $stream.Dispose()
484
492
$WriteTypeViewSplat.EventName = $eventNames
485
493
}
486
494
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 ) {
488
497
$WriteTypeViewSplat.HideProperty = $hideProperty
489
498
Write-TypeView @WriteTypeViewSplat
490
499
}
You can’t perform that action at this time.
0 commit comments