diff options
author | Kevin Chabowski <kevin@kch42.de> | 2014-05-01 14:22:15 +0200 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2014-05-01 14:33:15 +0200 |
commit | 500af457c12a8c11c4b32301f6ab324248c4ccaa (patch) | |
tree | fdb4c474e6cc0e8717cee4edac875faefdb0f1f6 /main.go | |
parent | ac3aafafeef06bc38d1b980807786e2558edb2cb (diff) | |
download | startpage-500af457c12a8c11c4b32301f6ab324248c4ccaa.tar.gz startpage-500af457c12a8c11c4b32301f6ab324248c4ccaa.tar.bz2 startpage-500af457c12a8c11c4b32301f6ab324248c4ccaa.zip |
Introduced new config file format
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -90,11 +90,30 @@ func loadTemplate() { panic(errors.New("could not find template in $GOPATH/src/github.com/kch42/startpage")) } +func initCmds() { + RegisterCommand("add-link", addLinkCmd) + RegisterCommand("set-weather-place", setPlaceCmd) +} + +func runConf() { + f, err := os.Open(os.ExpandEnv("$HOME/.startpagerc")) + if err != nil { + log.Fatalf("Could not open startpagerc: %s", err) + } + defer f.Close() + + if err := RunCommands(f); err != nil { + log.Fatal(err) + } +} + func main() { laddr := flag.String("laddr", ":25145", "Listen on this port") flag.Parse() loadTemplate() + initCmds() + runConf() pornch := make(chan bool) weatherch := make(chan bool) |