Skip to content

Commit

Permalink
Make status prefixes configurable for issue 11.
Browse files Browse the repository at this point in the history
  • Loading branch information
Craig Stuntz committed Apr 19, 2012
1 parent e08d4f7 commit 489afd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions HgPrompt.ps1
Expand Up @@ -17,25 +17,25 @@ function Write-HgStatus($status = (get-hgStatus)) {
Write-Host $status.Branch -NoNewline -BackgroundColor $branchBg -ForegroundColor $branchFg

if($status.Added) {
Write-Host " +$($status.Added)" -NoNewline -BackgroundColor $s.AddedBackgroundColor -ForegroundColor $s.AddedForegroundColor
Write-Host "$($s.AddedStatusPrefix)$($status.Added)" -NoNewline -BackgroundColor $s.AddedBackgroundColor -ForegroundColor $s.AddedForegroundColor

This comment has been minimized.

Copy link
@CraigStuntz

CraigStuntz Apr 20, 2012

Owner

Would be nice if someone confirms that this is a good way to concatenate these two strings. I'm no Powershell expert.

}
if($status.Modified) {
Write-Host " ~$($status.Modified)" -NoNewline -BackgroundColor $s.ModifiedBackgroundColor -ForegroundColor $s.ModifiedForegroundColor
Write-Host "$($s.ModifiedStatusPrefix)$($status.Modified)" -NoNewline -BackgroundColor $s.ModifiedBackgroundColor -ForegroundColor $s.ModifiedForegroundColor
}
if($status.Deleted) {
Write-Host " -$($status.Deleted)" -NoNewline -BackgroundColor $s.DeletedBackgroundColor -ForegroundColor $s.DeletedForegroundColor
Write-Host "$($s.DeletedStatusPrefix)$($status.Deleted)" -NoNewline -BackgroundColor $s.DeletedBackgroundColor -ForegroundColor $s.DeletedForegroundColor
}

if ($status.Untracked) {
Write-Host " ?$($status.Untracked)" -NoNewline -BackgroundColor $s.UntrackedBackgroundColor -ForegroundColor $s.UntrackedForegroundColor
Write-Host "$($s.UntrackedStatusPrefix)$($status.Untracked)" -NoNewline -BackgroundColor $s.UntrackedBackgroundColor -ForegroundColor $s.UntrackedForegroundColor
}

if($status.Missing) {
Write-Host " !$($status.Missing)" -NoNewline -BackgroundColor $s.MissingBackgroundColor -ForegroundColor $s.MissingForegroundColor
Write-Host "$($s.MissingStatusPrefix)$($status.Missing)" -NoNewline -BackgroundColor $s.MissingBackgroundColor -ForegroundColor $s.MissingForegroundColor
}

if($status.Renamed) {
Write-Host " ^$($status.Renamed)" -NoNewline -BackgroundColor $s.RenamedBackgroundColor -ForegroundColor $s.RenamedForegroundColor
Write-Host "$($s.RenamedStatusPrefix)$($status.Renamed)" -NoNewline -BackgroundColor $s.RenamedBackgroundColor -ForegroundColor $s.RenamedForegroundColor
}

if($s.ShowTags -and ($status.Tags.Length -or $status.ActiveBookmark.Length)) {
Expand Down
8 changes: 8 additions & 0 deletions Settings.ps1
Expand Up @@ -47,4 +47,12 @@ $global:PoshHgSettings = New-Object PSObject -Property @{
AppliedPatchBackgroundColor = $Host.UI.RawUI.BackgroundColor
PatchSeparator = ''
PatchSeparatorColor = [ConsoleColor]::White

# Status Count Prefixes for prompt
AddedStatusPrefix = ' +'
ModifiedStatusPrefix = ' ~'
DeletedStatusPrefix = ' -'
UntrackedStatusPrefix = ' ?'
MissingStatusPrefix = ' !'
RenamedStatusPrefix = ' ^'
}

0 comments on commit 489afd1

Please sign in to comment.