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 {
bail(1, "unable to parse cli args: %s", err)
}
var doc *Doc
f, err := os.Open(DefaultPath)
if err != nil {
bail(1, "unable to open moon config file at path %s: %s", DefaultPath, err)
}
if err == nil {
defer f.Close()
doc, err := Read(f)
d, err := Read(f)
if err != nil {
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 {
doc.items[k] = v

Loading…
Cancel
Save