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")
|
|
|
|
|
2017-11-04 10:37:59 +01:00
|
|
|
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
|
|
|
|
}
|