2021-12-22 17:23:38 +00:00
|
|
|
if (Get-InstalledModule -Name posh-git) {
|
|
|
|
Import-Module posh-git
|
2021-12-22 18:04:40 +00:00
|
|
|
}
|
2021-12-22 17:23:38 +00:00
|
|
|
else {
|
2021-12-22 18:04:40 +00:00
|
|
|
Write-Output "Installing prompt... (this may take a moment)"
|
2021-12-22 17:23:38 +00:00
|
|
|
Set-PSRepository -name PSGallery -InstallationPolicy Trusted
|
|
|
|
Install-Module posh-git -Scope CurrentUser -Force -Repository PSGallery
|
|
|
|
Import-Module posh-git
|
|
|
|
}
|
|
|
|
|
|
|
|
$GitPromptSettings.DefaultPromptPrefix.ForegroundColor = [ConsoleColor]::Magenta
|
|
|
|
$GitPromptSettings.DefaultPromptPath.ForegroundColor = [ConsoleColor]::Orange
|
|
|
|
|
|
|
|
function global:PromptWriteErrorInfo() {
|
|
|
|
if ($global:GitPromptValues.DollarQuestion) { return }
|
|
|
|
|
|
|
|
if ($global:GitPromptValues.LastExitCode) {
|
|
|
|
"`e[31m(" + $global:GitPromptValues.LastExitCode + ") `e[0m"
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
"`e[31m! `e[0m"
|
|
|
|
}
|
|
|
|
}
|