Created
January 3, 2021 01:09
-
-
Save aggresss/2a213d1520d5e2980e1ef39da31621aa to your computer and use it in GitHub Desktop.
Lazy load 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 git_prompt { | |
if (-not $(Get-InstalledModule -Name "posh-git")) { | |
Install-Module posh-git -Scope CurrentUser -Force | |
} | |
if (-not (Get-Module -Name "posh-git")) { | |
Import-Module -Name posh-git -Scope Global | |
} | |
else { | |
$GitPromptSettings.EnablePromptStatus = -not $GitPromptSettings.EnablePromptStatus | |
} | |
} | |
Set-Alias p git_prompt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment