Skip to content

Commit

Permalink
Rearrange stuff a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Oct 18, 2024
1 parent 4031fc8 commit 71b0c24
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Private/Write-Text.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
[CmdletBinding()]
param(
[Parameter(Position = 0)][string] $Text,
[System.ConsoleColor] $Color = [System.ConsoleColor]::Cyan,
[System.ConsoleColor] $ColorTime = [System.ConsoleColor]::Green,
[System.ConsoleColor] $Color,
[System.ConsoleColor] $ColorBefore,
[System.ConsoleColor] $ColorTime,
[switch] $Start,
[switch] $End,
[System.Diagnostics.Stopwatch] $Time,
[ValidateSet('Plus', 'Minus', 'Information', 'Addition')][string] $PreAppend,
[ValidateSet('Plus', 'Minus', 'Information', 'Addition', 'Error')][string] $PreAppend,
[string] $SpacesBefore
)
if ($PreAppend) {
Expand All @@ -31,9 +32,23 @@
if (-not $ColorBefore) {
$ColorBefore = [System.ConsoleColor]::Yellow
}
} elseif ($PreAppend -eq 'Error') {
$TextBefore = "$SpacesBefore[e] "
if (-not $ColorBefore) {
$ColorBefore = [System.ConsoleColor]::Red
}
if (-not $Color) {
$Color = [System.ConsoleColor]::Red
}
}
Write-Host -Object "$TextBefore" -NoNewline -ForegroundColor $ColorBefore
}
if (-not $Color) {
$Color = [System.ConsoleColor]::Cyan
}
if (-not $ColorTime) {
$ColorTime = [System.ConsoleColor]::Green
}
if (-not $Start -and -not $End) {
Write-Host "$Text" -ForegroundColor $Color
}
Expand Down

0 comments on commit 71b0c24

Please sign in to comment.