fix: correctly count recipes

This commit is contained in:
decentral1se 2022-01-01 21:46:38 +01:00
parent 3119220c21
commit 0a550363b8
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
1 changed files with 4 additions and 1 deletions

View File

@ -40,6 +40,7 @@ var recipeListCommand = &cli.Command{
tableCol := []string{"name", "category", "status", "healthcheck", "backups", "email", "tests", "SSO"} tableCol := []string{"name", "category", "status", "healthcheck", "backups", "email", "tests", "SSO"}
table := formatter.CreateTable(tableCol) table := formatter.CreateTable(tableCol)
len := 0
for _, recipe := range recipes { for _, recipe := range recipes {
tableRow := []string{ tableRow := []string{
recipe.Name, recipe.Name,
@ -55,13 +56,15 @@ var recipeListCommand = &cli.Command{
if pattern != "" { if pattern != "" {
if strings.Contains(recipe.Name, pattern) { if strings.Contains(recipe.Name, pattern) {
table.Append(tableRow) table.Append(tableRow)
len++
} }
} else { } else {
table.Append(tableRow) table.Append(tableRow)
len++
} }
} }
table.SetCaption(true, fmt.Sprintf("total recipes: %v", len(recipes))) table.SetCaption(true, fmt.Sprintf("total recipes: %v", len))
if table.NumLines() > 0 { if table.NumLines() > 0 {
table.Render() table.Render()