diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-04 19:47:25 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2019-11-05 19:22:01 +1100 |
commit | d5e443e8e3609fe38586aed942a3dae3343dbe47 (patch) | |
tree | 6d7465b9abd8df3ae903e6d95898054ac3a6d8b4 /pkg/commands/commit_file.go | |
parent | a3c84296bf2fbc8b132d5b2285eedba09813fbee (diff) |
Support building and moving patches
WIP
Diffstat (limited to 'pkg/commands/commit_file.go')
-rw-r--r-- | pkg/commands/commit_file.go | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/pkg/commands/commit_file.go b/pkg/commands/commit_file.go index 8bc6a11c2..ddd09b23b 100644 --- a/pkg/commands/commit_file.go +++ b/pkg/commands/commit_file.go @@ -1,13 +1,42 @@ package commands +import ( + "github.com/fatih/color" + "github.com/jesseduffield/lazygit/pkg/theme" +) + // CommitFile : A git commit file type CommitFile struct { Sha string Name string DisplayString string + Status int // one of 'WHOLE' 'PART' 'NONE' } +const ( + // UNSELECTED is for when the commit file has not been added to the patch in any way + UNSELECTED = iota + // WHOLE is for when you want to add the whole diff of a file to the patch, + // including e.g. if it was deleted + WHOLE = iota + // PART is for when you're only talking about specific lines that have been modified + PART +) + // GetDisplayStrings is a function. func (f *CommitFile) GetDisplayStrings(isFocused bool) []string { - return []string{f.DisplayString} + yellow := color.New(color.FgYellow) + green := color.New(color.FgGreen) + defaultColor := color.New(theme.DefaultTextColor) + + var colour *color.Color + switch f.Status { + case UNSELECTED: + colour = defaultColor + case WHOLE: + colour = green + case PART: + colour = yellow + } + return []string{colour.Sprint(f.DisplayString)} } |