forked from toolshed/abra
fix(recipe): output correct formatted json for recipe version
This commit is contained in:
parent
e609924af0
commit
8a0274cac0
@ -54,8 +54,9 @@ var recipeVersionCommand = cli.Command{
|
|||||||
logrus.Fatalf("%s has no catalogue published versions?", recipe.Name)
|
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-- {
|
for i := len(recipeMeta.Versions) - 1; i >= 0; i-- {
|
||||||
tableCols := []string{"version", "service", "image", "tag"}
|
|
||||||
table := formatter.CreateTable(tableCols)
|
table := formatter.CreateTable(tableCols)
|
||||||
for version, meta := range recipeMeta.Versions[i] {
|
for version, meta := range recipeMeta.Versions[i] {
|
||||||
var versions [][]string
|
var versions [][]string
|
||||||
@ -67,11 +68,10 @@ var recipeVersionCommand = cli.Command{
|
|||||||
|
|
||||||
for _, version := range versions {
|
for _, version := range versions {
|
||||||
table.Append(version)
|
table.Append(version)
|
||||||
|
aggregated_table.Append(version)
|
||||||
}
|
}
|
||||||
|
|
||||||
if internal.MachineReadable {
|
if !internal.MachineReadable {
|
||||||
table.JSONRender()
|
|
||||||
} else {
|
|
||||||
table.SetAutoMergeCellsByColumnIndex([]int{0})
|
table.SetAutoMergeCellsByColumnIndex([]int{0})
|
||||||
table.SetAlignment(tablewriter.ALIGN_LEFT)
|
table.SetAlignment(tablewriter.ALIGN_LEFT)
|
||||||
table.Render()
|
table.Render()
|
||||||
@ -79,6 +79,9 @@ var recipeVersionCommand = cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if internal.MachineReadable {
|
||||||
|
aggregated_table.JSONRender()
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user