diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-17 21:02:30 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-09-17 21:02:30 +1000 |
commit | c00c834b359bc0ebcd6e940e5cb5ef6f7247a6c7 (patch) | |
tree | 67ca05580afab38e8a743d6c3fcf91caa1cf82ee /pkg/commands/commit.go | |
parent | 3b765e5417501a39bca5c2f0038488dbbeb6b200 (diff) |
standardise rendering of lists in panels
Diffstat (limited to 'pkg/commands/commit.go')
-rw-r--r-- | pkg/commands/commit.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pkg/commands/commit.go b/pkg/commands/commit.go new file mode 100644 index 000000000..37c3e9525 --- /dev/null +++ b/pkg/commands/commit.go @@ -0,0 +1,26 @@ +package commands + +import ( + "github.com/fatih/color" +) + +// Commit : A git commit +type Commit struct { + Sha string + Name string + Pushed bool + DisplayString string +} + +func (c *Commit) GetDisplayStrings() []string { + red := color.New(color.FgRed) + yellow := color.New(color.FgYellow) + white := color.New(color.FgWhite) + + shaColor := yellow + if c.Pushed { + shaColor = red + } + + return []string{shaColor.Sprint(c.Sha), white.Sprint(c.Name)} +} |