From 20c7c0db7f70bc2e3ba2b55dc36b167114fd4a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20=C3=87=C4=B1dam?= Date: Mon, 2 Mar 2026 15:22:44 +0100 Subject: [PATCH] hiding custom recipes --- custom-recipes/buildernet/mkosi/playground.yaml | 3 ++- main.go | 9 ++++++++- playground/custom_recipes.go | 2 ++ playground/recipe_yaml.go | 3 +++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/custom-recipes/buildernet/mkosi/playground.yaml b/custom-recipes/buildernet/mkosi/playground.yaml index 15a4df5b..66f85265 100644 --- a/custom-recipes/buildernet/mkosi/playground.yaml +++ b/custom-recipes/buildernet/mkosi/playground.yaml @@ -1,5 +1,6 @@ base: buildernet -description: Deploy the stack with the BuilderNet mkosi image (QEMU) +description: Deploy the stack with the BuilderNet mkosi image (QEMU) - check out the README before running! +hidden: true recipe: builder-vm: diff --git a/main.go b/main.go index b46961e8..ec48279b 100644 --- a/main.go +++ b/main.go @@ -474,8 +474,11 @@ var recipesCmd = &cobra.Command{ } whiteTitleColor.Println("Custom Recipes:") for _, cr := range customRecipes { - fmt.Println(" " + customRecipesColor.Sprint(cr)) info, err := playground.GetCustomRecipeInfo(cr, recipes) + if err == nil && info.Hidden { + continue + } + fmt.Println(" " + customRecipesColor.Sprint(cr)) if err == nil { if info.Description != "" { descriptionColor.Add(color.Bold).Printf(" %s\n", info.Description) @@ -575,6 +578,10 @@ func main() { var customRecipes []playground.Recipe for _, crName := range customRecipeNames { + info, err := playground.GetCustomRecipeInfo(crName, recipes) + if err == nil && info.Hidden { + continue // Skip hidden custom recipes + } customRecipe, cleanup, err := playground.LoadCustomRecipe(crName, recipes) if err != nil { continue // Skip invalid custom recipes diff --git a/playground/custom_recipes.go b/playground/custom_recipes.go index 66927ba3..e22b8c0d 100644 --- a/playground/custom_recipes.go +++ b/playground/custom_recipes.go @@ -56,6 +56,7 @@ type CustomRecipeInfo struct { Name string Description string Base string + Hidden bool ModifiedComponents []string NewComponents []string } @@ -94,6 +95,7 @@ func GetCustomRecipeInfo(customRecipeName string, baseRecipes []Recipe) (*Custom Name: customRecipeName, Base: config.Base, Description: config.Description, + Hidden: config.Hidden, } // Find the base recipe to get its components diff --git a/playground/recipe_yaml.go b/playground/recipe_yaml.go index ff25c0cf..db9f3748 100644 --- a/playground/recipe_yaml.go +++ b/playground/recipe_yaml.go @@ -22,6 +22,9 @@ type YAMLRecipeConfig struct { // Description is an optional description of the recipe Description string `yaml:"description,omitempty"` + // Hidden indicates this recipe should be excluded from listings and automated discovery + Hidden bool `yaml:"hidden,omitempty"` + // Setup is a list of shell commands to run before any services are launched. // Commands run sequentially in the recipe's directory; each must exit 0. Setup []string `yaml:"setup,omitempty"`