From d52dad3681e9a8ec7053ebe420a232818164d847 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Thu, 19 Dec 2024 15:55:08 +0100 Subject: [PATCH] name set in yaml is equivalent to --project-name Signed-off-by: Nicolas De Loof --- cli/options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cli/options.go b/cli/options.go index caa07666..5cf5297c 100644 --- a/cli/options.go +++ b/cli/options.go @@ -482,6 +482,15 @@ func (o *ProjectOptions) prepare(ctx context.Context) (*types.ConfigDetails, err return configDetails, err } + if o.Name == "" { + // if any of the compose file is named, this is equivalent to user passing --project-name + for _, cfg := range configDetails.ConfigFiles { + if n, ok := cfg.Config["name"]; ok { + o.Name = fmt.Sprint(n) + } + } + } + o.loadOptions = append(o.loadOptions, withNamePrecedenceLoad(defaultDir, o), withConvertWindowsPaths(o),