Skip to content

Instantly share code, notes, and snippets.

@jthelin
Created February 13, 2015 18:05
Show Gist options
  • Save jthelin/6a572122a4de7c267497 to your computer and use it in GitHub Desktop.
Save jthelin/6a572122a4de7c267497 to your computer and use it in GitHub Desktop.
PoshGit -- PS Profile code to support different depot root locations on different machines.
if (Test-Path 'E:\Depot')
{
$DepotPath = 'E:\Depot'
}
else
{
$DepotPath = 'C:\Depot'
}
# Load posh-git example profile
. "$DepotPath\GitHub\posh-git\profile.example.ps1"
Rename-Item Function:\Prompt PoshGitPrompt -Force
function Prompt() {
if(Test-Path Function:\PrePoshGitPrompt)
{
++$global:poshScope;
New-Item function:\script:Write-host -value "param([object] `$object, `$backgroundColor, `$foregroundColor, [switch] `$nonewline) " -Force | Out-Null;$private:p = PrePoshGitPrompt;
if(--$global:poshScope -eq 0)
{
Remove-Item function:\Write-Host -Force
}
}
PoshGitPrompt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment