@@ -11,6 +11,7 @@ import (
11
11
"os/exec"
12
12
"strings"
13
13
14
+ "github.com/fatih/color"
14
15
"github.com/lmittmann/tint"
15
16
"github.com/mattn/go-colorable"
16
17
"github.com/spf13/cobra"
@@ -33,7 +34,13 @@ const (
33
34
YAMLOutputFormat = "yaml"
34
35
)
35
36
36
- var errAborted = errors .New ("operation aborted" )
37
+ var (
38
+ errAborted = errors .New ("operation aborted" )
39
+
40
+ WhiteBold = color .New (color .FgHiWhite , color .Bold ).SprintFunc ()
41
+ RedBold = color .New (color .FgHiRed , color .Bold ).SprintFunc ()
42
+ YellowBold = color .New (color .FgHiYellow , color .Bold ).SprintFunc ()
43
+ )
37
44
38
45
type Printer struct {
39
46
Cmd * cobra.Command
@@ -106,13 +113,13 @@ func (p *Printer) Warn(msg string, args ...any) {
106
113
return
107
114
}
108
115
warning := fmt .Sprintf (msg , args ... )
109
- p .Cmd .PrintErrf ("Warning: %s" , warning )
116
+ p .Cmd .PrintErrf ("%s %s" , YellowBold ( "Warning:" ) , warning )
110
117
}
111
118
112
119
// Print an Error level output to the defined Err output (falling back to Stderr if not set).
113
120
func (p * Printer ) Error (msg string , args ... any ) {
114
121
err := fmt .Sprintf (msg , args ... )
115
- p .Cmd .PrintErrln (p .Cmd .ErrPrefix (), err )
122
+ p .Cmd .PrintErrln (RedBold ( p .Cmd .ErrPrefix () ), err )
116
123
}
117
124
118
125
// Prompts the user for confirmation.
0 commit comments