Private/Colorize.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
function Colorize {
    Param
    (
        [parameter(Mandatory = $false,Position = 0,ValueFromPipeline = $true)]
        [String[]]
        $Strings
    )
    Process {
        foreach ($row in $Strings) {
            if ($row -like "*STACK NAME *" -or $row -like "*REFRESH *") {
                Write-Host -ForegroundColor Black -BackgroundColor Cyan $row
            }
            elseif ($row -like "*FAILED*") {
                Write-Host -ForegroundColor Black -BackgroundColor Red $row
            }
            elseif ($row -like "*REVIEW_IN_PROGRESS*") {
                Write-Host -ForegroundColor Black -BackgroundColor Gray $row
            }
            elseif ($row -like "*UPDATE_IN_PROGRESS*") {
                Write-Host -ForegroundColor Cyan $row
            }
            elseif ($row -like "*UPDATE_COMPLETE*") {
                Write-Host -BackgroundColor Cyan -ForegroundColor Black $row
            }
            elseif ($row -like "*CREATE_IN_PROGRESS*") {
                Write-Host -ForegroundColor Green $row
            }
            elseif ($row -like "*CREATE_COMPLETE*") {
                Write-Host -BackgroundColor Green -ForegroundColor Black $row
            }
            elseif ($row -like "*DELETE_IN_PROGRESS*") {
                Write-Host -ForegroundColor Yellow $row
            }
            elseif ($row -like "*DELETE_COMPLETE*") {
                Write-Host -BackgroundColor Yellow -ForegroundColor Black $row
            }
            elseif ($row -like "*DELETE_SKIPPED*") {
                Write-Host -BackgroundColor Magenta -ForegroundColor Black $row
            }
            elseif ($row -like "Timestamp*" -or $row -like "---------*") {
                Write-Host $row
            }
            else {
                Write-Host $row
            }
        }
    }
}