aboutsummaryrefslogtreecommitdiffstats
path: root/commands/ls.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-17 20:23:14 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-17 20:23:14 +0200
commit1332a6ec0a00b2475bc2b7b35b4c61425361d6b6 (patch)
treeff9ee93ea4a3bafc99d049d4f0c7b9f199ff0fec /commands/ls.go
parent9e6c687fca71103fd7550e25c471b9f805337b09 (diff)
downloadgit-bug-1332a6ec0a00b2475bc2b7b35b4c61425361d6b6.tar.gz
ls: add some colors
Diffstat (limited to 'commands/ls.go')
-rw-r--r--commands/ls.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/commands/ls.go b/commands/ls.go
index ac0bcfbb..0d188833 100644
--- a/commands/ls.go
+++ b/commands/ls.go
@@ -4,6 +4,7 @@ import (
"fmt"
b "github.com/MichaelMure/git-bug/bug"
"github.com/MichaelMure/git-bug/repository"
+ "github.com/MichaelMure/git-bug/util"
)
func runLsBug(repo repository.Repo, args []string) error {
@@ -22,7 +23,24 @@ func runLsBug(repo repository.Repo, args []string) error {
snapshot := bug.Compile()
- fmt.Printf("%s %s\t%s\t%s\n", bug.HumanId(), snapshot.Status, snapshot.Title, snapshot.Summary())
+ var author b.Person
+
+ if len(snapshot.Comments) > 0 {
+ create := snapshot.Comments[0]
+ author = create.Author
+ }
+
+ // truncate + pad if needed
+ titleFmt := fmt.Sprintf("%-50.50s", snapshot.Title)
+ authorFmt := fmt.Sprintf("%-15.15s", author.Name)
+
+ fmt.Printf("%s %s\t%s\t%s\t%s\n",
+ util.Cyan(bug.HumanId()),
+ util.Yellow(snapshot.Status),
+ titleFmt,
+ util.Magenta(authorFmt),
+ snapshot.Summary(),
+ )
}
return nil