diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-20 09:41:29 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-20 09:41:29 +1000 |
commit | 8fac19c17575c78753a0ed4e8116312ca3d5573e (patch) | |
tree | ddc9096070bd9f96a9320b04419d4178fe7bb998 /pkg/commands/commit.go | |
parent | c789bba673da883af4d812a85819d6309c915f34 (diff) | |
parent | 7b90d2496b56d89863b552b226f45b8de2bd1551 (diff) |
Merge branch 'master' into feature/informative-commit-colors
Diffstat (limited to 'pkg/commands/commit.go')
-rw-r--r-- | pkg/commands/commit.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkg/commands/commit.go b/pkg/commands/commit.go new file mode 100644 index 000000000..54e94ef60 --- /dev/null +++ b/pkg/commands/commit.go @@ -0,0 +1,30 @@ +package commands + +import ( + "github.com/fatih/color" +) + +// Commit : A git commit +type Commit struct { + Sha string + Name string + Pushed bool + Merged bool + DisplayString string +} + +func (c *Commit) GetDisplayStrings() []string { + red := color.New(color.FgRed) + yellow := color.New(color.FgGreen) + green := color.New(color.FgYellow) + white := color.New(color.FgWhite) + + shaColor := yellow + if c.Pushed { + shaColor = red + } else if !c.Merged { + shaColor = green + } + + return []string{shaColor.Sprint(c.Sha), white.Sprint(c.Name)} +} |