mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
feat: enable posh-git on $GitPromptSettings.EnablePromptStatus
relates to https://github.com/dahlbyk/posh-git/issues/883
This commit is contained in:
parent
c7b681a2b5
commit
749eb6cf26
|
@ -10,7 +10,6 @@ Display the [posh-git][posh-git] prompt.
|
||||||
|
|
||||||
:::caution
|
:::caution
|
||||||
This segment only works within Powershell and requires the posh-git module to be installed and imported.
|
This segment only works within Powershell and requires the posh-git module to be installed and imported.
|
||||||
To enable the `posh-git` module, set `$env:POSH_GIT_ENABLED = $true` in your `$PROFILE`.
|
|
||||||
:::
|
:::
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
|
@ -57,11 +57,9 @@ function global:Get-PoshContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
function global:Initialize-ModuleSupport {
|
function global:Initialize-ModuleSupport {
|
||||||
if ($env:POSH_GIT_ENABLED -eq $true -and (Get-Module -Name "posh-git")) {
|
if ($GitPromptSettings.EnablePromptStatus) {
|
||||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSProvideCommentHelp', '', Justification = 'Variable used later (not in this scope)')]
|
|
||||||
$global:GitStatus = Get-GitStatus
|
$global:GitStatus = Get-GitStatus
|
||||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSProvideCommentHelp', '', Justification = 'Variable used by posh-git (not in this script)')]
|
$GitPromptSettings.EnablePromptStatus = $false
|
||||||
$GitPromptSettings = $null
|
|
||||||
$env:POSH_GIT_STATUS = Write-GitStatus -Status $global:GitStatus
|
$env:POSH_GIT_STATUS = Write-GitStatus -Status $global:GitStatus
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue