more README stuff, example README, other misc cleanup
This commit is contained in:
+8
-1
@@ -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
|
||||
}
|
||||
|
||||
@@ -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,3 +1,4 @@
|
||||
// Code generated by github.com/Khan/genql, DO NOT EDIT.
|
||||
package {{.PackageName}}
|
||||
|
||||
import (
|
||||
|
||||
Reference in New Issue
Block a user