File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,10 @@ import (
21
21
"io/ioutil"
22
22
"os"
23
23
24
+ "golang.org/x/crypto/ssh/terminal"
25
+
26
+ "github.com/mattn/go-colorable"
27
+
24
28
"github.com/arduino/go-paths-helper"
25
29
26
30
"github.com/arduino/arduino-cli/commands"
@@ -75,7 +79,13 @@ func preRun(cmd *cobra.Command, args []string) {
75
79
logrus .SetOutput (ioutil .Discard )
76
80
} else {
77
81
// Else print on stderr.
78
- commands .ErrLogrus .Out = os .Stderr
82
+
83
+ // Workaround to get colored output on windows
84
+ if terminal .IsTerminal (int (os .Stdout .Fd ())) {
85
+ logrus .SetFormatter (& logrus.TextFormatter {ForceColors : true })
86
+ }
87
+ logrus .SetOutput (colorable .NewColorableStdout ())
88
+ commands .ErrLogrus .Out = colorable .NewColorableStderr ()
79
89
formatter .SetLogger (commands .ErrLogrus )
80
90
}
81
91
initConfigs ()
You can’t perform that action at this time.
0 commit comments