mirror of
https://github.com/tw93/Mole.git
synced 2026-02-04 17:24:45 +00:00
feat: add default icons and colors fallback in logging module
This commit is contained in:
@@ -12,6 +12,46 @@ $script:MOLE_LOG_LOADED = $true
|
|||||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||||
. "$scriptDir\base.ps1"
|
. "$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
|
# Log Configuration
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user