Makefiles with code coverage generation, terminal detection for color strippage

This commit is contained in:
Olivier Tremblay 2016-05-25 18:59:50 -04:00
parent 6adb5c4920
commit 5a2f3f98ac
No known key found for this signature in database
GPG key ID: 1A9FE7C1DFF65CB0
3 changed files with 7 additions and 1 deletions

2
Makefile Normal file
View file

@ -0,0 +1,2 @@
all:
go test -coverprofile=c.out -covermode=count

3
cmd/jkl/Makefile Normal file
View file

@ -0,0 +1,3 @@
all:
go build
go test -coverprofile=c.out -covermode=count

View file

@ -8,6 +8,7 @@ import (
"text/template" "text/template"
"fmt" "fmt"
"golang.org/x/crypto/ssh/terminal"
"otremblay.com/jkl" "otremblay.com/jkl"
) )
@ -22,7 +23,7 @@ func init() {
type listissue jkl.Issue type listissue jkl.Issue
func (l *listissue) Color() string { func (l *listissue) Color() string {
if os.Getenv("JKLNOCOLOR") == "true" { if os.Getenv("JKLNOCOLOR") == "true" || !terminal.IsTerminal(int(os.Stdout.Fd())) {
return "" return ""
} }
if strings.Contains(os.Getenv("RED_ISSUE_STATUSES"), l.Fields.Status.Name) { if strings.Contains(os.Getenv("RED_ISSUE_STATUSES"), l.Fields.Status.Name) {