feat: include local recipes on auto-complete
This commit is contained in:
@ -3,6 +3,7 @@ package autocomplete
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"coopcloud.tech/abra/pkg/app"
|
"coopcloud.tech/abra/pkg/app"
|
||||||
appPkg "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
|
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
|
var recipeNames []string
|
||||||
for name := range catl {
|
for name := range catl {
|
||||||
recipeNames = append(recipeNames, name)
|
recipeNames = append(recipeNames, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, recipeLocal := range localRecipes {
|
||||||
|
recipeNames = append(recipeNames, recipeLocal)
|
||||||
|
}
|
||||||
|
|
||||||
return recipeNames, cobra.ShellCompDirectiveDefault
|
return recipeNames, cobra.ShellCompDirectiveDefault
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user