diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-17 20:23:14 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-17 20:23:14 +0200 |
commit | 1332a6ec0a00b2475bc2b7b35b4c61425361d6b6 (patch) | |
tree | ff9ee93ea4a3bafc99d049d4f0c7b9f199ff0fec /commands/ls.go | |
parent | 9e6c687fca71103fd7550e25c471b9f805337b09 (diff) | |
download | git-bug-1332a6ec0a00b2475bc2b7b35b4c61425361d6b6.tar.gz |
ls: add some colors
Diffstat (limited to 'commands/ls.go')
-rw-r--r-- | commands/ls.go | 20 |
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 |