apigen/config.go

26 lines
481 B
Go
Raw Normal View History

package main
import (
"flag"
"gopkg.in/yaml.v2"
"io/ioutil"
)
type Config struct {
2020-11-06 23:16:52 +00:00
Gofname string `yaml:"gofname"`
Goimpldir string `yaml:"goimpldir"`
Tsfname string `json:"tsfname"`
Goclifname string `json:"goclifname"`
}
var config Config
func loadConfig() {
fname := flag.String("f", ".apigen.yaml", "File with config to load - defaults to '.apigen'")
flag.Parse()
bs, err := ioutil.ReadFile(*fname)
Err(err)
err = yaml.Unmarshal(bs, &config)
Err(err)
}