more README stuff, example README, other misc cleanup

This commit is contained in:
Ben Kraft
2020-01-16 17:56:13 -08:00
parent 2c3702e282
commit 35699a73ef
7 changed files with 52 additions and 3 deletions
+8 -1
View File
@@ -62,7 +62,7 @@ func ReadAndValidateConfig(filename string) (*Config, error) {
}
var config Config
err = yaml.Unmarshal(text, config)
err = yaml.Unmarshal(text, &config)
if err != nil {
return nil, fmt.Errorf("invalid config file %v: %v", filename, err)
}
@@ -72,5 +72,12 @@ func ReadAndValidateConfig(filename string) (*Config, error) {
return nil, fmt.Errorf("invalid config file %v: %v", filename, err)
}
// Make paths relative to config dir
// TODO: more principled typing here?
basename := filepath.Dir(filename)
config.Schema = filepath.Join(basename, config.Schema)
config.Queries = filepath.Join(basename, config.Queries)
config.Generated = filepath.Join(basename, config.Generated)
return &config, nil
}
+1
View File
@@ -46,6 +46,7 @@ func Main() {
}()
if len(os.Args) != 2 {
// TODO: omit config to get it from genql.yaml, or to use the defaults.
err = fmt.Errorf("usage: %s genql.yaml", os.Args[0])
return
}
+1
View File
@@ -1,3 +1,4 @@
// Code generated by github.com/Khan/genql, DO NOT EDIT.
package {{.PackageName}}
import (