@@ -42,14 +42,15 @@ Function Get-ChildItemColor {
4242Function Get-ChildItemColorFormatWide {
4343 Param (
4444 [string ]$Path = " " ,
45- [switch ]$Force
45+ [switch ]$Force ,
46+ [switch ]$HideHeader
4647 )
4748
4849 $nnl = $True
4950
5051 $Expression = " Get-ChildItem -Path `" $Path `" $Args "
5152
52- if ($Force ) {$Expression += " -Force" }
53+ If ($Force ) {$Expression += " -Force" }
5354
5455 $Items = Invoke-Expression $Expression
5556
@@ -67,8 +68,7 @@ Function Get-ChildItemColorFormatWide {
6768 If ($Item.PSParentPath -match " FileSystem" ) {
6869 $ParentType = " Directory"
6970 $ParentName = $Item.PSParentPath.Replace (" Microsoft.PowerShell.Core\FileSystem::" , " " )
70- }
71- ElseIf ($Item.PSParentPath -match " Registry" ) {
71+ } ElseIf ($Item.PSParentPath -match " Registry" ) {
7272 $ParentType = " Hive"
7373 $ParentName = $Item.PSParentPath.Replace (" Microsoft.PowerShell.Core\Registry::" , " " )
7474 }
@@ -78,7 +78,12 @@ Function Get-ChildItemColorFormatWide {
7878 $LastParentName = $ParentName
7979 }
8080
81- If ($LastParentName -ne $ParentName ) {
81+ If ($i -eq 0 -and $HideHeader ) {
82+ Write-Host " "
83+ }
84+
85+ # write header
86+ If ($LastParentName -ne $ParentName -and -not $HideHeader ) {
8287 If ($i -ne 0 -AND $Host.UI.RawUI.CursorPosition.X -ne 0 ){ # conditionally add an empty line
8388 Write-Host " "
8489 }
@@ -95,7 +100,6 @@ Function Get-ChildItemColorFormatWide {
95100 For ($l = 1 ; $l -le $GetChildItemColorVerticalSpace ; $l ++ ) {
96101 Write-Host " "
97102 }
98-
99103 }
100104
101105 $nnl = ++ $i % $cols -ne 0
@@ -189,8 +193,7 @@ Function Out-Default {
189193 }
190194 }
191195
192- End
193- {
196+ End {
194197 Try {
195198 For ($l = 1 ; $l -le $GetChildItemColorVerticalSpace ; $l ++ ) {
196199 Write-Host " "
0 commit comments