Add some color to the relevant filenames in terminal log

Fixes #5344
This commit is contained in:
Bjørn Erik Pedersen
2018-10-24 11:14:51 +02:00
parent 889aca054a
commit deff9e154b
4 changed files with 79 additions and 1 deletions

View File

@@ -18,8 +18,10 @@ import (
"fmt"
"io"
"io/ioutil"
"os"
"strings"
"github.com/gohugoio/hugo/common/terminal"
"github.com/gohugoio/hugo/helpers"
"github.com/spf13/afero"
@@ -27,6 +29,12 @@ import (
var fileErrorFormat = "\"%s:%d:%d\": %s"
func init() {
if terminal.IsTerminal(os.Stdout) {
fileErrorFormat = terminal.Notice("\"%s:%d:%d\"") + ": %s"
}
}
// LineMatcher contains the elements used to match an error to a line
type LineMatcher struct {
FileError FileError