1
0
mirror of https://github.com/tw93/Mole.git synced 2026-02-04 12:41:46 +00:00

feat: add default icons and colors fallback in logging module

This commit is contained in:
tw93
2026-02-02 17:47:03 +08:00
parent 3bd2869e8d
commit f91cf05bc8

View File

@@ -12,6 +12,46 @@ $script:MOLE_LOG_LOADED = $true
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
. "$scriptDir\base.ps1"
# Fallbacks in case base.ps1 did not initialize icons/colors in this scope
if (-not ($script:Icons -is [hashtable])) {
$script:Icons = @{}
}
$iconDefaults = @{
List = "*"
Success = "+"
Warning = "!"
Error = "x"
DryRun = ">"
Arrow = ">"
}
foreach ($key in $iconDefaults.Keys) {
if (-not $script:Icons.ContainsKey($key)) {
$script:Icons[$key] = $iconDefaults[$key]
}
}
if (-not ($script:Colors -is [hashtable])) {
$script:Colors = @{}
}
$colorDefaults = @{
Cyan = ""
Green = ""
Yellow = ""
Red = ""
Gray = ""
PurpleBold = ""
NC = ""
}
foreach ($key in $colorDefaults.Keys) {
if (-not $script:Colors.ContainsKey($key)) {
$script:Colors[$key] = $colorDefaults[$key]
}
}
# ============================================================================
# Log Configuration
# ============================================================================