mirror of
https://github.com/go-task/task.git
synced 2025-11-25 22:32:55 +02:00
Add --color=false flag to disable colored output
This commit is contained in:
@@ -25,6 +25,7 @@ type Logger struct {
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
Verbose bool
|
||||
Color bool
|
||||
}
|
||||
|
||||
// Outf prints stuff to STDOUT.
|
||||
@@ -32,6 +33,9 @@ func (l *Logger) Outf(print PrintFunc, s string, args ...interface{}) {
|
||||
if len(args) == 0 {
|
||||
s, args = "%s", []interface{}{s}
|
||||
}
|
||||
if !l.Color {
|
||||
print = Default
|
||||
}
|
||||
print(l.Stdout, s+"\n", args...)
|
||||
}
|
||||
|
||||
@@ -47,6 +51,9 @@ func (l *Logger) Errf(print PrintFunc, s string, args ...interface{}) {
|
||||
if len(args) == 0 {
|
||||
s, args = "%s", []interface{}{s}
|
||||
}
|
||||
if !l.Color {
|
||||
print = Default
|
||||
}
|
||||
print(l.Stderr, s+"\n", args...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user