From 148d67a90188047fd0aabd12a49e0bfb0a6d171a Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sat, 18 Nov 2017 02:06:36 +0900 Subject: [PATCH] Paint outputs --- examples/markdown.feature | 2 +- main.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/markdown.feature b/examples/markdown.feature index d21a727..46afc95 100644 --- a/examples/markdown.feature +++ b/examples/markdown.feature @@ -40,4 +40,4 @@ Feature: Markdown """ When I run `linkcheck foo.md` Then the exit status should be 1 - And the stderr should contain "ERROR: " + And the stderr should contain "ERROR" diff --git a/main.go b/main.go index 5986041..aeb3d49 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "github.com/a8m/mark" "github.com/docopt/docopt-go" + "github.com/fatih/color" "golang.org/x/net/html" ) @@ -38,8 +39,10 @@ func main() { ok := true for s := range extractURLs(n) { + colored := color.New(color.FgCyan).SprintFunc()(s) + if _, err := http.Get(s); err != nil { - printToStderr("ERROR: " + err.Error()) + printToStderr(color.New(color.FgRed).SprintFunc()("ERROR") + "\t" + colored + "\t" + err.Error()) ok = false } }