dispatch/main.go

35 lines
578 B
Go
Raw Normal View History

2015-01-17 01:37:21 +00:00
package main
import (
"io/ioutil"
"log"
"os"
"path"
"github.com/khlieng/name_pending/assets"
"github.com/khlieng/name_pending/commands"
"github.com/khlieng/name_pending/storage"
2015-01-17 01:37:21 +00:00
)
func main() {
initConfig()
commands.Execute()
2015-01-17 01:37:21 +00:00
}
func initConfig() {
configPath := path.Join(storage.AppDir, "config.toml")
if _, err := os.Stat(configPath); os.IsNotExist(err) {
config, err := assets.Asset("config.default.toml")
if err != nil {
log.Println(err)
return
}
err = ioutil.WriteFile(configPath, config, 0600)
if err != nil {
log.Println(err)
}
}
}