Skip to content

Instantly share code, notes, and snippets.

@AKuederle
Created June 28, 2015 23:12
Show Gist options
  • Save AKuederle/507f4d9a2fa00037ca69 to your computer and use it in GitHub Desktop.
Save AKuederle/507f4d9a2fa00037ca69 to your computer and use it in GitHub Desktop.
Overwrite of powershell promt which works with gitposh and provides last argument and last command varibales
function global:prompt {
$realLASTEXITCODE = $LASTEXITCODE
$global:l = "$($(Get-History)[-1])"
$temp = "$($(Get-History)[-1])" -split " "
$global:lc = $temp[0]
$global:lp = $temp[1..($temp.length-1)]
# Reset color, which can be messed up by Enable-GitColors
$Host.UI.RawUI.ForegroundColor = $GitPromptSettings.DefaultForegroundColor
Write-Host($(Split-Path $pwd -Leaf)) -nonewline -foregroundcolor Blue
Write-VcsStatus
$global:LASTEXITCODE = $realLASTEXITCODE
return " $ "
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment