Skip to content

Commit 7f8d900

Browse files
committed
Colorize make targets
1 parent 0ab6aef commit 7f8d900

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.13
55
require (
66
github.com/apex/log v1.1.1
77
github.com/campoy/tools v1.0.0 // indirect
8+
github.com/fatih/color v1.7.0
89
github.com/pkg/errors v0.8.1
910
github.com/segmentio/go-env v1.1.0
1011
)

help/help.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"sort"
99
"strings"
1010

11+
"github.com/fatih/color"
1112
"github.com/pkg/errors"
1213

1314
"github.com/tj/mmake/parser"
@@ -59,7 +60,7 @@ func OutputAllLong(r io.Reader, w io.Writer, targets []string) error {
5960
// getComments parses, filters, and sorts all comment nodes.
6061
func getComments(r io.Reader, targets []string) ([]parser.Comment, error) {
6162
nodes, err := parser.ParseRecursive(r, resolver.IncludePath)
62-
63+
6364
if err != nil {
6465
return nil, errors.Wrap(err, "parsing")
6566
}
@@ -126,7 +127,7 @@ func printVerbose(w io.Writer, c parser.Comment) (int, error) {
126127
c.Value = c.Value + " (default)"
127128
}
128129

129-
return fmt.Fprintf(w, " %-s:\n%-s\n\n", c.Target, indent(indent(c.Value)))
130+
return fmt.Fprintf(w, " %-s:\n%-s\n\n", color.HiBlueString(c.Target), indent(indent(c.Value)))
130131
}
131132

132133
func printShort(w io.Writer, c parser.Comment, width int) (int, error) {
@@ -135,5 +136,5 @@ func printShort(w io.Writer, c parser.Comment, width int) (int, error) {
135136
comment = comment + " (default)"
136137
}
137138

138-
return fmt.Fprintf(w, " %-*s %-s\n", width+2, c.Target, comment)
139+
return fmt.Fprintf(w, " %-*s %-s\n", width+2, color.HiBlueString(c.Target), comment)
139140
}

0 commit comments

Comments
 (0)