1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 18:15:42 +01:00

Print warning if no config file was found

This commit is contained in:
koplas 2025-06-27 17:20:19 +02:00
parent c833c00f84
commit a7b1291be8
No known key found for this signature in database

View file

@ -46,7 +46,6 @@ type Parser[C any] struct {
// If a config file was specified it is loaded. // If a config file was specified it is loaded.
// Returns the arguments and the configuration. // Returns the arguments and the configuration.
func (p *Parser[C]) Parse() ([]string, *C, error) { func (p *Parser[C]) Parse() ([]string, *C, error) {
var cmdLineOpts C var cmdLineOpts C
if p.SetDefaults != nil { if p.SetDefaults != nil {
p.SetDefaults(&cmdLineOpts) p.SetDefaults(&cmdLineOpts)
@ -82,6 +81,7 @@ func (p *Parser[C]) Parse() ([]string, *C, error) {
// No config file -> We are good. // No config file -> We are good.
if path == "" { if path == "" {
slog.Warn("No config file found. Maybe you want to specify one or store it in a respective default location", "locations", p.DefaultConfigLocations)
return args, &cmdLineOpts, nil return args, &cmdLineOpts, nil
} }