refactor: de-indent and error handle up front
continuous-integration/drone/push Build is passing Details

This commit is contained in:
decentral1se 2021-09-06 00:45:29 +02:00
parent a0625bf133
commit e1a10723ce
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 16 additions and 13 deletions

View File

@ -22,21 +22,24 @@ var recipeVersionCommand = &cli.Command{
return nil
}
if recipe, ok := catalogue[recipe]; ok {
tableCol := []string{"Version", "Service", "Image", "Digest"}
table := formatter.CreateTable(tableCol)
for version := range recipe.Versions {
for service := range recipe.Versions[version] {
meta := recipe.Versions[version][service]
table.Append([]string{version, service, meta.Image, meta.Digest})
}
}
table.SetAutoMergeCells(true)
table.Render()
return nil
rec, ok := catalogue[recipe]
if !ok {
logrus.Fatalf("'%s' recipe doesn't exist?", recipe)
}
logrus.Fatalf("'%s' recipe doesn't exist?", recipe)
tableCol := []string{"Version", "Service", "Image", "Digest"}
table := formatter.CreateTable(tableCol)
for version := range rec.Versions {
for service := range rec.Versions[version] {
meta := rec.Versions[version][service]
table.Append([]string{version, service, meta.Image, meta.Digest})
}
}
table.SetAutoMergeCells(true)
table.Render()
return nil
},
}