Skip to content

Commit

Permalink
Merge branch 'feature/Add-option-hide-header' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
joonro committed Jun 6, 2022
2 parents a1ea22e + bc5c968 commit 403a28c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Get-ChildItemColor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ Function Get-ChildItemColor {
Function Get-ChildItemColorFormatWide {
Param(
[string]$Path = "",
[switch]$Force
[switch]$Force,
[switch]$HideHeader
)

$nnl = $True

$Expression = "Get-ChildItem -Path `"$Path`" $Args"

if ($Force) {$Expression += " -Force"}
If ($Force) {$Expression += " -Force"}

$Items = Invoke-Expression $Expression

Expand All @@ -67,8 +68,7 @@ Function Get-ChildItemColorFormatWide {
If ($Item.PSParentPath -match "FileSystem") {
$ParentType = "Directory"
$ParentName = $Item.PSParentPath.Replace("Microsoft.PowerShell.Core\FileSystem::", "")
}
ElseIf ($Item.PSParentPath -match "Registry") {
} ElseIf ($Item.PSParentPath -match "Registry") {
$ParentType = "Hive"
$ParentName = $Item.PSParentPath.Replace("Microsoft.PowerShell.Core\Registry::", "")
}
Expand All @@ -78,7 +78,12 @@ Function Get-ChildItemColorFormatWide {
$LastParentName = $ParentName
}

If ($LastParentName -ne $ParentName) {
If ($i -eq 0 -and $HideHeader) {
Write-Host ""
}

# write header
If ($LastParentName -ne $ParentName -and -not $HideHeader) {
If ($i -ne 0 -AND $Host.UI.RawUI.CursorPosition.X -ne 0){ # conditionally add an empty line
Write-Host ""
}
Expand All @@ -95,7 +100,6 @@ Function Get-ChildItemColorFormatWide {
For ($l=1; $l -le $GetChildItemColorVerticalSpace; $l++) {
Write-Host ""
}

}

$nnl = ++$i % $cols -ne 0
Expand Down Expand Up @@ -189,8 +193,7 @@ Function Out-Default {
}
}

End
{
End {
Try {
For ($l=1; $l -le $GetChildItemColorVerticalSpace; $l++) {
Write-Host ""
Expand Down

0 comments on commit 403a28c

Please sign in to comment.