mirror of
https://github.com/kovetskiy/mark.git
synced 2025-04-24 05:42:40 +08:00
Ignore error if default config file does not exist
This commit is contained in:
parent
2f44bcb6be
commit
4c3d417725
6
main.go
6
main.go
@ -154,7 +154,11 @@ func main() {
|
|||||||
filePath := context.String("config")
|
filePath := context.String("config")
|
||||||
return altsrc.NewTomlSourceFromFile(filePath)
|
return altsrc.NewTomlSourceFromFile(filePath)
|
||||||
} else {
|
} else {
|
||||||
// Fall back to default if config is unset
|
// Fall back to default if config is unset and path exists
|
||||||
|
_, err := os.Stat(filepath.Join(os.Getenv("HOME"), ".config/mark"))
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
return &altsrc.MapInputSource{}, nil
|
||||||
|
}
|
||||||
return altsrc.NewTomlSourceFromFile(filepath.Join(os.Getenv("HOME"), ".config/mark"))
|
return altsrc.NewTomlSourceFromFile(filepath.Join(os.Getenv("HOME"), ".config/mark"))
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user