From 5a2f3f98ac811ebeb0bbaf022fd25ada06442cb7 Mon Sep 17 00:00:00 2001 From: Olivier Tremblay Date: Wed, 25 May 2016 18:59:50 -0400 Subject: [PATCH] Makefiles with code coverage generation, terminal detection for color strippage --- Makefile | 2 ++ cmd/jkl/Makefile | 3 +++ cmd/jkl/list.go | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 Makefile create mode 100644 cmd/jkl/Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9b6f1da --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + go test -coverprofile=c.out -covermode=count diff --git a/cmd/jkl/Makefile b/cmd/jkl/Makefile new file mode 100644 index 0000000..6c86b62 --- /dev/null +++ b/cmd/jkl/Makefile @@ -0,0 +1,3 @@ +all: + go build + go test -coverprofile=c.out -covermode=count diff --git a/cmd/jkl/list.go b/cmd/jkl/list.go index 3f13fc2..14640c8 100644 --- a/cmd/jkl/list.go +++ b/cmd/jkl/list.go @@ -8,6 +8,7 @@ import ( "text/template" "fmt" + "golang.org/x/crypto/ssh/terminal" "otremblay.com/jkl" ) @@ -22,7 +23,7 @@ func init() { type listissue jkl.Issue func (l *listissue) Color() string { - if os.Getenv("JKLNOCOLOR") == "true" { + if os.Getenv("JKLNOCOLOR") == "true" || !terminal.IsTerminal(int(os.Stdout.Fd())) { return "" } if strings.Contains(os.Getenv("RED_ISSUE_STATUSES"), l.Fields.Status.Name) {