From 040b15b240094789d012124c8d1b6d59993640a3 Mon Sep 17 00:00:00 2001 From: "Anand Babu (AB) Periasamy" Date: Fri, 17 Apr 2015 16:31:30 -0700 Subject: [PATCH] disable console theme on Windows --- cmd-options.go | 2 +- pkg/console/console.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd-options.go b/cmd-options.go index 3dae820e..8146cf82 100644 --- a/cmd-options.go +++ b/cmd-options.go @@ -207,7 +207,7 @@ var ( flags = []cli.Flag{ cli.StringFlag{ Name: "theme", - Value: "minimal", + Value: console.GetDefaultTheme(), Usage: fmt.Sprintf("Choose a console theme from this list [%s]", func() string { keys := []string{} for key := range console.ThemesDB { diff --git a/pkg/console/console.go b/pkg/console/console.go index 18c9dcb7..6b806e9f 100644 --- a/pkg/console/console.go +++ b/pkg/console/console.go @@ -20,6 +20,7 @@ import ( "errors" "fmt" "os" + "runtime" "sync" "github.com/fatih/color" @@ -30,7 +31,7 @@ var ( mutex = &sync.RWMutex{} // currentTheme is currently set theme - currentTheme = "minimal" + currentTheme = GetDefaultTheme() // ThemesDB contains supported list of Themes ThemesDB = map[string]Theme{"minimal": MiniTheme, "nocolor": NoColorTheme, "white": WhiteTheme} // Fatal prints a fatal message and exits @@ -153,3 +154,11 @@ func SetTheme(themeName string) error { func GetTheme() string { return currentTheme } + +// GetDefaultTheme returns the default theme +func GetDefaultTheme() string { + if runtime.GOOS == "windows" { + return "nocolor" + } + return "minimal" +}