Posh-git: Customize Profile prompt GitPromptSettings changed

Created on 30 May 2018  路  4Comments  路  Source: dahlbyk/posh-git

System Details

  • posh-git version/path: 0.7.3 C:\Program Files\WindowsPowerShell\Modules\posh-git\0.7.3
  • PowerShell version:5.1.17134.48
  • Git version:2.17.1
  • Operating system name and version: Windows 10 | 10.0.17134.48

Issue Description

I am experiencing a problem with...$GitPromptSettings appears to have changed as the Wiki article on customizing has some options that don't exit and I'm not able to find the proper setting:
https://github.com/dahlbyk/posh-git/wiki/Customizing-Your-PowerShell-Prompt

I'm interested in if anyone happens to know what the new setting that replaced this is now: $GitPromptSettings.DefaultPromptPrefix.ForegroundColor

I've tried $GitPromptSettings.BeforeForegroundColor = [ConsoleColor]::Cyan and that does not seem to have any effect.

Most helpful comment

@schwindelig is correct. There's an incomplete v0 section on that wiki page, but for a full list it's best to consult the v0 source: https://github.com/dahlbyk/posh-git/blob/v0.7.3.1/src/GitPrompt.ps1#L4-L119. The prompt customization experience, including adjusting colors for DefaultPromptPrefix (and basically everything), is greatly improved by upgrading to 1.0.0-beta2.

If you don't wish to upgrade to v1, you can cheat a bit to colorize DefaultPromptPrefix:

$GitPromptSettings.DefaultPromptPrefix = '$(Write-Host (1 + (Get-History -Count 1 | % Id)) -ForegroundColor Cyan -NoNewLine) '

All 4 comments

I had the same issue, but noticed that the described properties are for version >1.0.0. Updating the module to the latest pre-release made them available.

Which would be what version? I'm on 0.7.3

@schwindelig is correct. There's an incomplete v0 section on that wiki page, but for a full list it's best to consult the v0 source: https://github.com/dahlbyk/posh-git/blob/v0.7.3.1/src/GitPrompt.ps1#L4-L119. The prompt customization experience, including adjusting colors for DefaultPromptPrefix (and basically everything), is greatly improved by upgrading to 1.0.0-beta2.

If you don't wish to upgrade to v1, you can cheat a bit to colorize DefaultPromptPrefix:

$GitPromptSettings.DefaultPromptPrefix = '$(Write-Host (1 + (Get-History -Count 1 | % Id)) -ForegroundColor Cyan -NoNewLine) '
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rkeithhill picture rkeithhill  路  5Comments

codedog picture codedog  路  7Comments

exbuzz picture exbuzz  路  7Comments

jpierson picture jpierson  路  9Comments

ghost picture ghost  路  7Comments