Last active
April 3, 2017 12:20
-
-
Save DanPuzey/27c4e895435d68d3f561212034e3c38a to your computer and use it in GitHub Desktop.
Super-hacky git REPL for PowerShell/Posh-Git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GitPrompt() | |
{ | |
Write-Host | |
$realLASTEXITCODE = $LASTEXITCODE | |
$Host.UI.RawUI.ForegroundColor = "White" | |
Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green | |
checkGit($pwd.ProviderPath) | |
$global:LASTEXITCODE = $realLASTEXITCODE | |
Write-Host "`ngit> " -NoNewLine -ForegroundColor "DarkGray" | |
} | |
GitPrompt | |
$usrEntry = Read-Host | |
while ($usrEntry -ne 'exit') | |
{ | |
if ($usrEntry.Trim().Length -gt 0) | |
{ | |
git $usrEntry.Split(" ") | |
} | |
GitPrompt | |
$usrEntry = Read-Host -prompt $p | |
} |
Edit: allow no command to redisplay status (without including help text).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Edit: make multi-param commands work correctly.