Browse Source

Paint outputs

renovate/configure
Yota Toyama 8 years ago
parent
commit
148d67a901
  1. 2
      examples/markdown.feature
  2. 5
      main.go

2
examples/markdown.feature

@ -40,4 +40,4 @@ Feature: Markdown
""" """
When I run `linkcheck foo.md` When I run `linkcheck foo.md`
Then the exit status should be 1 Then the exit status should be 1
And the stderr should contain "ERROR: " And the stderr should contain "ERROR"

5
main.go

@ -10,6 +10,7 @@ import (
"github.com/a8m/mark" "github.com/a8m/mark"
"github.com/docopt/docopt-go" "github.com/docopt/docopt-go"
"github.com/fatih/color"
"golang.org/x/net/html" "golang.org/x/net/html"
) )
@ -38,8 +39,10 @@ func main() {
ok := true ok := true
for s := range extractURLs(n) { for s := range extractURLs(n) {
colored := color.New(color.FgCyan).SprintFunc()(s)
if _, err := http.Get(s); err != nil { 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 ok = false
} }
} }

Loading…
Cancel
Save