Update PS1 prompt, thanks to perikiyoxd
All checks were successful
All checks were successful
This commit is contained in:
parent
d8d25de0d0
commit
6463d50cd3
@ -35,13 +35,23 @@ version
|
||||
|
||||
# Invoke shell with fancy prompt
|
||||
function global:prompt {
|
||||
$esc = [char]27
|
||||
$resetColor = "$esc[0m"
|
||||
$pathColor = "$esc[1;34m"
|
||||
$toolchainColor = "$esc[1;97;44m"
|
||||
$toolchainText = "${toolchainColor} XT Toolchain "
|
||||
$pathText = "${pathColor}$($PWD.ProviderPath) "
|
||||
$arrow = "⮀"
|
||||
"${toolchainText}$arrow$pathText$resetColor> "
|
||||
$PROMPT = " XT Toolchain "
|
||||
$CWD = (Get-Location).Path
|
||||
$CHEVRON = [char]0xE0B0
|
||||
$SEGMENTS = @(
|
||||
@{ TEXT = $PROMPT; BGCOLOR = "Blue"; FGCOLOR = "White" },
|
||||
@{ TEXT = " $CWD "; BGCOLOR = "DarkCyan"; FGCOLOR = "White" }
|
||||
)
|
||||
for ($INDEX = 0; $INDEX -lt $SEGMENTS.Count; $INDEX++) {
|
||||
$SEGMENT = $SEGMENTS[$INDEX]
|
||||
$NEXTBG = if ($INDEX + 1 -lt $SEGMENTS.Count) { $SEGMENTS[$INDEX + 1].BGCOLOR } else { "Default" }
|
||||
Write-Host $SEGMENT.TEXT -NoNewLine -ForegroundColor $SEGMENT.FGCOLOR -BackgroundColor $SEGMENT.BGCOLOR
|
||||
if ($NEXTBG -ne "Default") {
|
||||
Write-Host $CHEVRON -NoNewLine -ForegroundColor $SEGMENT.BGCOLOR -BackgroundColor $NEXTBG
|
||||
} else {
|
||||
Write-Host $CHEVRON -NoNewLine -ForegroundColor $SEGMENT.BGCOLOR
|
||||
}
|
||||
}
|
||||
return " "
|
||||
}
|
||||
Set-Location -Path $SRCDIR
|
||||
|
Loading…
x
Reference in New Issue
Block a user