File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed
Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -127,12 +127,25 @@ if (Get-Module NuGet) {
127127 $WindowTitleSupported = $false
128128}
129129
130- function Write-Prompt ($Object , $ForegroundColor , $BackgroundColor = -1 ) {
131- if ($BackgroundColor -lt 0 ) {
132- Write-Host $Object - NoNewLine - ForegroundColor $ForegroundColor
133- } else {
134- Write-Host $Object - NoNewLine - ForegroundColor $ForegroundColor - BackgroundColor $BackgroundColor
130+ function Write-Prompt ($Object , $ForegroundColor = $null , $BackgroundColor = $null ) {
131+ if ($BackgroundColor -is [string ]) {
132+ $BackgroundColor = [ConsoleColor ]$BackgroundColor
135133 }
134+ if ($ForegroundColor -is [string ]) {
135+ $ForegroundColor = [ConsoleColor ]$ForegroundColor
136+ }
137+
138+ $writeHostParams = @ {
139+ Object = $Object ;
140+ NoNewLine = $true ;
141+ }
142+ if (($BackgroundColor -ge 0 ) -and ($BackgroundColor -le 15 )) {
143+ $writeHostParams.BackgroundColor = $BackgroundColor
144+ }
145+ if (($ForegroundColor -ge 0 ) -and ($ForegroundColor -le 15 )) {
146+ $writeHostParams.ForegroundColor = $ForegroundColor
147+ }
148+ Write-Host @writeHostParams
136149}
137150
138151function Format-BranchName ($branchName ){
You can’t perform that action at this time.
0 commit comments