fix: make recipe name autocomplete less slow #604
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/567"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
See #567. My proposal was #567 (comment).
Benefit along the way: it's now possible to autocomplete remote recipes.
@ -39,3 +40,3 @@// RecipeNameComplete completes recipe names.func RecipeNameComplete() ([]string, cobra.ShellCompDirective) {catl, err := recipe.ReadRecipeCatalogue(false)catl, err := recipe.ReadRecipeCatalogue(true)Even when offline, I think it would be nice to "cache" the catalogue in memory. Otherwise everytime we hit it reads the recipe catalogue again. What do you think @decentral1se
@p4u1 good idea, that does make a lot of sense. I can see we are doing multiple calls in some code paths. Should we maybe try something like https://github.com/kofalt/go-memoize for this? Otherwise,
cobradoes provide context, but it might be awkward putting that in / retrieving it elsewhere...I tried it out but I fear the situation that people then want a flag or some way to bust the cache or they don't even realise it is being cache and can't seem to get the latest catalogue values... I am gonna leave this off for someone smarter than me 🙃
@ -50,2 +57,4 @@}for _, recipeLocal := range localRecipes {recipeNames = append(recipeNames, recipeLocal)Sweet!
2e37c14fc4toa30282e1c1a30282e1c1to727753bd2e727753bd2eto42dde0930d