1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Cleaner config format and added simple_config.yml example

This commit is contained in:
Chris Cummer
2018-04-10 10:12:25 -07:00
committed by Chris Cummer
parent 948d5acb2a
commit 27a267b123
18 changed files with 285 additions and 133 deletions

View File

@@ -19,7 +19,7 @@ func Fetch(cityID int) *owm.CurrentWeatherData {
/* -------------------- Unexported Functions -------------------- */
func currentWeather(apiKey string, cityCode int) (*owm.CurrentWeatherData, error) {
weather, err := owm.NewCurrent(Config.UString("wtf.weather.tempUnit", "C"), Config.UString("wtf.weather.language", "EN"), apiKey)
weather, err := owm.NewCurrent(Config.UString("wtf.mods.weather.tempUnit", "C"), Config.UString("wtf.mods.weather.language", "EN"), apiKey)
if err != nil {
return nil, err
}

View File

@@ -35,7 +35,7 @@ func (widget *Widget) Refresh() {
return
}
data := Fetch(Config.UInt("wtf.weather.cityId", 6176823))
data := Fetch(Config.UInt("wtf.mods.weather.cityId", 6176823))
widget.View.SetTitle(fmt.Sprintf(" %s Weather: [green]%s[white] ", icon(data), data.Name))
widget.RefreshedAt = time.Now()
@@ -72,7 +72,7 @@ func (widget *Widget) contentFrom(data *owm.CurrentWeatherData) string {
str = str + strings.Join(descs, ",") + "\n\n"
tempUnit := Config.UString("wtf.weather.tempUnit", "C")
tempUnit := Config.UString("wtf.mods.weather.tempUnit", "C")
str = str + fmt.Sprintf("%8s: %4.1f° %s\n", "High", data.Main.TempMax, tempUnit)
str = str + fmt.Sprintf("%8s: [green]%4.1f° %s[white]\n", "Current", data.Main.Temp, tempUnit)