Skip to content

Commit

Permalink
Merge pull request #822 from breisfeld/master
Browse files Browse the repository at this point in the history
Add BeforePath and AfterPath settings
  • Loading branch information
dahlbyk authored Dec 18, 2020
2 parents 0ae1924 + dfc3b43 commit 4a8cda0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ VERSION
*.log
*.nupkg
obj
.history
3 changes: 3 additions & 0 deletions src/PoshGitTypes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ class PoshGitPromptSettings {
[PoshGitTextSpan]$DelimStatus = [PoshGitTextSpan]::new(' |', [ConsoleColor]::Yellow)
[PoshGitTextSpan]$AfterStatus = [PoshGitTextSpan]::new(']', [ConsoleColor]::Yellow)

[PoshGitTextSpan]$BeforePath = [PoshGitTextSpan]::new('', [ConsoleColor]::Yellow)
[PoshGitTextSpan]$AfterPath = [PoshGitTextSpan]::new('', [ConsoleColor]::Yellow)

[PoshGitTextSpan]$BeforeIndex = [PoshGitTextSpan]::new('', [ConsoleColor]::DarkGreen)
[PoshGitTextSpan]$BeforeStash = [PoshGitTextSpan]::new(' (', [ConsoleColor]::Red)
[PoshGitTextSpan]$AfterStash = [PoshGitTextSpan]::new(')', [ConsoleColor]::Red)
Expand Down
7 changes: 6 additions & 1 deletion src/posh-git.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ $GitPromptScriptBlock = {
$global:GitPromptValues.IsAdmin = $IsAdmin

$settings = $global:GitPromptSettings

if (!$settings) {
return "<`$GitPromptSettings not found> "
}
Expand All @@ -65,13 +66,17 @@ $GitPromptScriptBlock = {
# Get the current path - formatted correctly
$promptPath = $settings.DefaultPromptPath.Expand()

# Write the path and Git status summary information
# Write the delimited path and Git status summary information
if ($settings.DefaultPromptWriteStatusFirst) {
$prompt += Write-VcsStatus
$prompt += Write-Prompt $settings.BeforePath.Expand()
$prompt += Write-Prompt $promptPath
$prompt += Write-Prompt $settings.AfterPath.Expand()
}
else {
$prompt += Write-Prompt $settings.BeforePath.Expand()
$prompt += Write-Prompt $promptPath
$prompt += Write-Prompt $settings.AfterPath.Expand()
$prompt += Write-VcsStatus
}

Expand Down

0 comments on commit 4a8cda0

Please sign in to comment.