Support colors on Windows (#1312)
parent
6b6a490c73
commit
256441692a
|
|
@ -31,7 +31,7 @@ func printInfo() {
|
|||
|
||||
func printLogo(c color.Paint) {
|
||||
for _, l := range ui.LogoSmall {
|
||||
fmt.Println(color.Colorize(l, c))
|
||||
fmt.Fprintln(out, color.Colorize(l, c))
|
||||
}
|
||||
fmt.Println()
|
||||
fmt.Fprintln(out)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/derailed/k9s/internal/color"
|
||||
"github.com/derailed/k9s/internal/config"
|
||||
"github.com/derailed/k9s/internal/view"
|
||||
"github.com/mattn/go-colorable"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
|
@ -33,6 +34,8 @@ var (
|
|||
Long: longAppDesc,
|
||||
Run: run,
|
||||
}
|
||||
|
||||
out = colorable.NewColorableStdout()
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
|
|
|||
|
|
@ -41,8 +41,8 @@ func printVersion(short bool) {
|
|||
|
||||
func printTuple(fmat, section, value string, outputColor color.Paint) {
|
||||
if outputColor != -1 {
|
||||
fmt.Printf(fmat, color.Colorize(section+":", outputColor), color.Colorize(value, color.LightGray))
|
||||
fmt.Fprintf(out, fmat, color.Colorize(section+":", outputColor), color.Colorize(value, color.LightGray))
|
||||
return
|
||||
}
|
||||
fmt.Printf(fmat, section, value)
|
||||
fmt.Fprintf(out, fmat, section, value)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue