don't fail if default config doesn't exist

master
Jordan Orelli 10 years ago
parent a587b2f3a1
commit 536c94a586

@ -36,16 +36,21 @@ func Parse(dest interface{}) {
if err != nil { if err != nil {
bail(1, "unable to parse cli args: %s", err) bail(1, "unable to parse cli args: %s", err)
} }
var doc *Doc
f, err := os.Open(DefaultPath) f, err := os.Open(DefaultPath)
if err != nil { if err == nil {
bail(1, "unable to open moon config file at path %s: %s", DefaultPath, err)
}
defer f.Close() defer f.Close()
d, err := Read(f)
doc, err := Read(f)
if err != nil { if err != nil {
bail(1, "unable to parse moon config file at path %s: %s", DefaultPath, err) bail(1, "unable to parse moon config file at path %s: %s", DefaultPath, err)
} }
doc = d
} else {
doc = &Doc{items: make(map[string]interface{})}
}
for k, v := range cliArgs { for k, v := range cliArgs {
doc.items[k] = v doc.items[k] = v

Loading…
Cancel
Save