Making our windows friends happy.

Now color is disabled if TERM is not set.
This commit is contained in:
Elia el Lazkani 2020-02-19 23:36:38 +01:00
parent df58715e92
commit f184474e60
No known key found for this signature in database
GPG key ID: FBD81F2B1F488C2B

View file

@ -165,7 +165,7 @@ func flagParser(cmdP *cmdParams) {
narrow := flag.Bool("narrow", false, "Display weather in narrow view") narrow := flag.Bool("narrow", false, "Display weather in narrow view")
quiet := flag.Bool("quiet", false, "Add the quiet flag") quiet := flag.Bool("quiet", false, "Add the quiet flag")
superQuiet := flag.Bool("super-quiet", false, "Add the super quiet flag") superQuiet := flag.Bool("super-quiet", false, "Add the super quiet flag")
noColors := flag.Bool("no-colors", false, "Disable displaying colors") noColors := flag.Bool("no-colors", false, "Disable displaying colors (always enabled on windows)")
addFrame := flag.Bool("add-frame", false, "Add a frame to the output") addFrame := flag.Bool("add-frame", false, "Add a frame to the output")
midTransparency := flag.Bool("mid-transparency", false, "Enable mid-transparency (PNG only)") midTransparency := flag.Bool("mid-transparency", false, "Enable mid-transparency (PNG only)")
transparency := flag.Bool("transparency", false, "Enable transparency (PNG only)") transparency := flag.Bool("transparency", false, "Enable transparency (PNG only)")
@ -177,6 +177,13 @@ func flagParser(cmdP *cmdParams) {
flag.Parse() flag.Parse()
// Windows does not have color encoding
// so let's make sure windows users are happy
term := os.Getenv("TERM")
if term == "" {
*noColors = true
}
if *metric { if *metric {
cmdP.Flags += METRIC cmdP.Flags += METRIC
} }