You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
916 B

package main
import (
"fmt"
"github.com/BurntSushi/toml"
"io/ioutil"
"os"
"statusscreen"
"time"
)
func main() {
config := getConfig("status.toml")
sl := statusscreen.SL{Config: &config}
clock := statusscreen.Clock{Config: &config}
weather := statusscreen.Weather{Config: &config}
for {
for _, row := range clock.GetOutput() {
fmt.Println(row)
}
for _, row := range weather.GetOutput() {
fmt.Println(row)
}
for _, row := range sl.GetOutput() {
fmt.Println(row)
}
time.Sleep(1 * time.Second)
}
}
func getConfig(configFile string) statusscreen.Config {
var config statusscreen.Config
// Read the configfile
file, err := ioutil.ReadFile(configFile)
if err != nil {
fmt.Printf("File error: %v\n", err)
os.Exit(1)
}
// Parse config
if _, err := toml.Decode(string(file), &config); err != nil {
fmt.Printf("Config error: %v\n", err)
os.Exit(1)
}
return config
}