2020-11-04 16:14:18 +00:00
|
|
|
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"`
|
2020-11-04 16:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|