1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

show file statuses in commit files view

This commit is contained in:
Jesse Duffield
2020-08-23 14:20:28 +10:00
parent 2f893bf361
commit 2915134007
3 changed files with 36 additions and 12 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/jesseduffield/lazygit/pkg/commands"
"github.com/jesseduffield/lazygit/pkg/commands/patch"
"github.com/jesseduffield/lazygit/pkg/theme"
"github.com/jesseduffield/lazygit/pkg/utils"
)
func GetCommitFileListDisplayStrings(commitFiles []*commands.CommitFile, diffName string) [][]string {
@ -37,5 +38,22 @@ func getCommitFileDisplayStrings(f *commands.CommitFile, diffed bool) []string {
if diffed {
colour = diffTerminalColor
}
return []string{colour.Sprint(f.DisplayString)}
return []string{utils.ColoredString(f.ChangeStatus, getColorForChangeStatus(f.ChangeStatus)), colour.Sprint(f.Name)}
}
func getColorForChangeStatus(changeStatus string) color.Attribute {
switch changeStatus {
case "A":
return color.FgGreen
case "M", "R":
return color.FgYellow
case "D":
return color.FgRed
case "C":
return color.FgCyan
case "T":
return color.FgMagenta
default:
return color.FgWhite
}
}