feat: include local recipes on auto-complete
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2025-08-18 10:11:41 +02:00
parent 5957eb3e13
commit 2e37c14fc4

View File

@ -3,6 +3,7 @@ package autocomplete
import (
"fmt"
"sort"
"strings"
"coopcloud.tech/abra/pkg/app"
appPkg "coopcloud.tech/abra/pkg/app"
@ -44,11 +45,21 @@ func RecipeNameComplete() ([]string, cobra.ShellCompDirective) {
return []string{err}, cobra.ShellCompDirectiveError
}
localRecipes, err := recipe.GetRecipesLocal()
if err != nil && !strings.Contains(err.Error(), "empty") {
err := fmt.Sprintf("autocomplete failed: %s", err)
return []string{err}, cobra.ShellCompDirectiveError
}
var recipeNames []string
for name := range catl {
recipeNames = append(recipeNames, name)
}
for _, recipeLocal := range localRecipes {
recipeNames = append(recipeNames, recipeLocal)
}
return recipeNames, cobra.ShellCompDirectiveDefault
}