From 1bdaf5854a26b4e3614c74e536ff2e911b2003ba Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Tue, 25 Jul 2023 10:53:18 +0200 Subject: [PATCH] Fallback to default config files if no config file was given. --- internal/options/options.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/options/options.go b/internal/options/options.go index ea80ca7..bead99d 100644 --- a/internal/options/options.go +++ b/internal/options/options.go @@ -73,7 +73,9 @@ func (p *Parser[C]) Parse() ([]string, *C, error) { // Do we have a config file explicitly given by command line? if p.ConfigLocation != nil { path = p.ConfigLocation(&cmdLineOpts) - } else { + } + // Fallback to defaults if we have not found any. + if path == "" && len(p.DefaultConfigLocations) > 0 { path = findConfigFile(p.DefaultConfigLocations) }