package recipe import ( "coopcloud.tech/abra/cli/internal" "coopcloud.tech/abra/pkg/autocomplete" "coopcloud.tech/abra/pkg/recipe" "github.com/sirupsen/logrus" "github.com/urfave/cli" ) var recipeFetchCommand = cli.Command{ Name: "fetch", Usage: "Fetch recipe(s)", Aliases: []string{"f"}, ArgsUsage: "[]", Description: "Retrieves all recipes if no argument is passed", Flags: []cli.Flag{ internal.DebugFlag, internal.NoInputFlag, }, Before: internal.SubCommandBefore, BashComplete: autocomplete.RecipeNameComplete, Action: func(c *cli.Context) error { recipeName := c.Args().First() if recipeName != "" { internal.ValidateRecipe(c) } if err := recipe.EnsureExists(recipeName); err != nil { logrus.Fatal(err) } if err := recipe.EnsureUpToDate(recipeName); err != nil { logrus.Fatal(err) } if err := recipe.EnsureLatest(recipeName); err != nil { logrus.Fatal(err) } return nil }, }