diff options
author | Bjørn Erik Pedersen <[email protected]> | 2018-10-24 11:14:51 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2018-10-24 13:02:18 +0200 |
commit | deff9e154bc0371af56741ddb22cb1f9e392838a (patch) | |
tree | 81456457be3a9f98a239cc6493ad5003c0b66e7b /common/herrors | |
parent | 889aca054a267506a1c7cfaa3992d324764d6358 (diff) | |
download | hugo-deff9e154bc0371af56741ddb22cb1f9e392838a.tar.gz hugo-deff9e154bc0371af56741ddb22cb1f9e392838a.zip |
Add some color to the relevant filenames in terminal log
Fixes #5344
Diffstat (limited to 'common/herrors')
-rw-r--r-- | common/herrors/error_locator.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/common/herrors/error_locator.go b/common/herrors/error_locator.go index 3f1aae689..cb59b65a3 100644 --- a/common/herrors/error_locator.go +++ b/common/herrors/error_locator.go @@ -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 |