Skip to content

Commit

Permalink
Test for hidden or system files ; added styles for those
Browse files Browse the repository at this point in the history
  • Loading branch information
micheldiemer committed Apr 20, 2024
1 parent b7cd6a4 commit d5f242b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Get-ChildItemColor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ function Get-FileColor($item) {

if ([bool]($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -and (-not $inOneDrive)) {
$key = 'Symlink'
} elseif ($item.GetType().Name -eq 'DirectoryInfo') {
$key = 'Directory'
} elseif ($item.IsReadOnly) {
$key = 'ReadOnly'
} elseif ($item.Attributes -band [System.IO.FileAttributes]::Hidden) {
$key = 'Hidden'
} elseif ($item.Attributes -band [System.IO.FileAttributes]::System) {
$key = 'System'
} elseif ($item.PSobject.Properties.Name -contains "Extension") {
If ($GetChildItemColorTable.File.ContainsKey($item.Extension)) {
$key = $item.Extension
Expand Down
6 changes: 6 additions & 0 deletions src/Get-ChildItemColorTable.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
$global:GetChildItemColorExtensions = @{}
$global:GetChildItemColorProps = @{}

$global:GetChildItemColorRegExTable = @{
File = @{ Default = $OriginalForegroundColor }
}

# starts with dot
$GetChildItemColorRegExTable.File.Add('^[.]','DarkRed')

Expand Down Expand Up @@ -174,6 +176,10 @@ $global:GetChildItemColorTable = @{
Match = @{ Default = $OriginalForegroundColor }
}

#$GetChildItemColorTable.File.Add('Archive',"DarkRed")
$GetChildItemColorTable.File.Add('Hidden',"DarkRed")
$GetChildItemColorTable.File.Add('System',"DarkRed")
$GetChildItemColorTable.File.Add('ReadOnly',"DarkRed")
$GetChildItemColorTable.File.Add('Directory', "Blue")
$GetChildItemColorTable.File.Add('Symlink', "Cyan")

Expand Down

0 comments on commit d5f242b

Please sign in to comment.