Skip to content

Instantly share code, notes, and snippets.

@aggresss
Created January 3, 2021 01:09
Show Gist options
  • Save aggresss/2a213d1520d5e2980e1ef39da31621aa to your computer and use it in GitHub Desktop.
Save aggresss/2a213d1520d5e2980e1ef39da31621aa to your computer and use it in GitHub Desktop.
Lazy load posh-git
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