Skip to content

Instantly share code, notes, and snippets.

@HerbM
Created April 1, 2018 13:28
Show Gist options
  • Save HerbM/abd73225cb2dd796350623a928b51e74 to your computer and use it in GitHub Desktop.
Save HerbM/abd73225cb2dd796350623a928b51e74 to your computer and use it in GitHub Desktop.
Old Prompt (2018 Mar 30)
Function Global:prompt {
If (!(Get-Variable MaxPrompt -ea 0 2>$Null)) { $MaxPrompt = 45 }
$loc = "$($executionContext.SessionState.Path.CurrentLocation)"
$Sig = " |>$('>' * $nestedPromptLevel)"
if ($Global:MaxPromptLength) {
$LocLen = $Loc.length; $SigLen = $Sig.Length
$Length = $LocLen + $SigLen
$Excess = $Length - $Global:MaxPromptLength
If ($Excess -gt 0) {
$Excess = [Math]::Min($Excess, $LocLen)
}
}
write-host -nonewline "'$Loc'$Sig" -fore Cyan -back DarkGray
' '
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment