diff options
author | Michael Muré <batolettre@gmail.com> | 2018-09-11 22:04:16 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-09-11 22:14:46 +0200 |
commit | 3605887345792d2f981f971c6c4a2cb7f86a343e (patch) | |
tree | afd525b6e3a638e4c619a5a986fcb2811c297444 /termui/bug_table.go | |
parent | 7b05983c19af4da70f2a9a5062913f4e4f5d5faa (diff) | |
download | git-bug-3605887345792d2f981f971c6c4a2cb7f86a343e.tar.gz |
reorganize package for a more idomatic go
Diffstat (limited to 'termui/bug_table.go')
-rw-r--r-- | termui/bug_table.go | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/termui/bug_table.go b/termui/bug_table.go index 59252b48..9ac04608 100644 --- a/termui/bug_table.go +++ b/termui/bug_table.go @@ -6,7 +6,8 @@ import ( "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/util" + "github.com/MichaelMure/git-bug/util/colors" + "github.com/MichaelMure/git-bug/util/text" "github.com/dustin/go-humanize" "github.com/jroimartin/gocui" ) @@ -296,18 +297,18 @@ func (bt *bugTable) render(v *gocui.View, maxX int) { person = create.Author } - id := util.LeftPaddedString(snap.HumanId(), columnWidths["id"], 2) - status := util.LeftPaddedString(snap.Status.String(), columnWidths["status"], 2) - title := util.LeftPaddedString(snap.Title, columnWidths["title"], 2) - author := util.LeftPaddedString(person.Name, columnWidths["author"], 2) - summary := util.LeftPaddedString(snap.Summary(), columnWidths["summary"], 2) - lastEdit := util.LeftPaddedString(humanize.Time(snap.LastEditTime()), columnWidths["lastEdit"], 2) + id := text.LeftPaddedString(snap.HumanId(), columnWidths["id"], 2) + status := text.LeftPaddedString(snap.Status.String(), columnWidths["status"], 2) + title := text.LeftPaddedString(snap.Title, columnWidths["title"], 2) + author := text.LeftPaddedString(person.Name, columnWidths["author"], 2) + summary := text.LeftPaddedString(snap.Summary(), columnWidths["summary"], 2) + lastEdit := text.LeftPaddedString(humanize.Time(snap.LastEditTime()), columnWidths["lastEdit"], 2) fmt.Fprintf(v, "%s %s %s %s %s %s\n", - util.Cyan(id), - util.Yellow(status), + colors.Cyan(id), + colors.Yellow(status), title, - util.Magenta(author), + colors.Magenta(author), summary, lastEdit, ) @@ -317,12 +318,12 @@ func (bt *bugTable) render(v *gocui.View, maxX int) { func (bt *bugTable) renderHeader(v *gocui.View, maxX int) { columnWidths := bt.getColumnWidths(maxX) - id := util.LeftPaddedString("ID", columnWidths["id"], 2) - status := util.LeftPaddedString("STATUS", columnWidths["status"], 2) - title := util.LeftPaddedString("TITLE", columnWidths["title"], 2) - author := util.LeftPaddedString("AUTHOR", columnWidths["author"], 2) - summary := util.LeftPaddedString("SUMMARY", columnWidths["summary"], 2) - lastEdit := util.LeftPaddedString("LAST EDIT", columnWidths["lastEdit"], 2) + id := text.LeftPaddedString("ID", columnWidths["id"], 2) + status := text.LeftPaddedString("STATUS", columnWidths["status"], 2) + title := text.LeftPaddedString("TITLE", columnWidths["title"], 2) + author := text.LeftPaddedString("AUTHOR", columnWidths["author"], 2) + summary := text.LeftPaddedString("SUMMARY", columnWidths["summary"], 2) + lastEdit := text.LeftPaddedString("LAST EDIT", columnWidths["lastEdit"], 2) fmt.Fprintf(v, "\n") fmt.Fprintf(v, "%s %s %s %s %s %s\n", id, status, title, author, summary, lastEdit) @@ -433,7 +434,7 @@ func (bt *bugTable) pull(g *gocui.Gui, v *gocui.View) error { }) } else { fmt.Fprintf(&buffer, "%s%s: %s", - beginLine, util.Cyan(merge.Bug.HumanId()), merge.Status, + beginLine, colors.Cyan(merge.Bug.HumanId()), merge.Status, ) beginLine = "\n" |