fix(recipe): output correct formatted json for recipe version
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Moritz 2024-05-21 16:59:59 +02:00
parent e609924af0
commit 8a0274cac0
1 changed files with 7 additions and 4 deletions

View File

@ -54,8 +54,9 @@ var recipeVersionCommand = cli.Command{
logrus.Fatalf("%s has no catalogue published versions?", recipe.Name)
}
tableCols := []string{"version", "service", "image", "tag"}
aggregated_table := formatter.CreateTable(tableCols)
for i := len(recipeMeta.Versions) - 1; i >= 0; i-- {
tableCols := []string{"version", "service", "image", "tag"}
table := formatter.CreateTable(tableCols)
for version, meta := range recipeMeta.Versions[i] {
var versions [][]string
@ -67,11 +68,10 @@ var recipeVersionCommand = cli.Command{
for _, version := range versions {
table.Append(version)
aggregated_table.Append(version)
}
if internal.MachineReadable {
table.JSONRender()
} else {
if !internal.MachineReadable {
table.SetAutoMergeCellsByColumnIndex([]int{0})
table.SetAlignment(tablewriter.ALIGN_LEFT)
table.Render()
@ -79,6 +79,9 @@ var recipeVersionCommand = cli.Command{
}
}
}
if internal.MachineReadable {
aggregated_table.JSONRender()
}
return nil
},