Skip to content

Commit

Permalink
windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn authored and schachmat committed May 15, 2015
1 parent dbaf38b commit 2db2996
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions we.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"github.com/mattn/go-colorable"
"io/ioutil"
"time"
"log"
Expand Down Expand Up @@ -496,21 +497,22 @@ func main() {
log.Fatal("Malformed response.")
}
fmt.Printf("Weather for %s: %s\n\n", r.Data.Req[0].Type, r.Data.Req[0].Query)
stdout := colorable.NewColorableStdout()

if r.Data.Cur == nil || len(r.Data.Cur) < 1 {
log.Fatal("No weather data available.")
}
out := formatCond(make([]string, 5), r.Data.Cur[0])
for _, val := range out {
fmt.Println(val)
fmt.Fprintln(stdout, val)
}

if r.Data.Weather == nil {
log.Fatal("No detailed weather forecast available.")
}
for _, d := range r.Data.Weather {
for _, val := range printDay(d) {
fmt.Println(val)
fmt.Fprintln(stdout, val)
}
}
}

0 comments on commit 2db2996

Please sign in to comment.