statusscreen/statusscreen.go

37 lines
603 B
Go
Raw Normal View History

2017-10-15 09:41:36 +02:00
package main
import (
"fmt"
"github.com/BurntSushi/toml"
"io/ioutil"
"os"
"statusscreen"
)
func main() {
config := getConfig("status.toml")
sl := statusscreen.SL{Config: &config}
2017-10-15 09:41:36 +02:00
fmt.Println(sl.GetOutput())
}
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
}