fix compose config --format json

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof
2024-03-18 08:08:20 +01:00
parent f937e42aaf
commit bc5fc6ba7e
3 changed files with 63 additions and 1 deletions

View File

@@ -160,7 +160,15 @@ func runConfig(ctx context.Context, dockerCli command.Cli, opts configOptions, s
if err != nil {
return err
}
content, err = project.MarshalYAML()
switch opts.Format {
case "json":
content, err = project.MarshalJSON()
case "yaml":
content, err = project.MarshalYAML()
default:
return fmt.Errorf("unsupported format %q", opts.Format)
}
if err != nil {
return err
}