refactor: centralise recipe validation

This commit is contained in:
2021-09-06 00:45:13 +02:00
parent 691a2c7a50
commit a0625bf133
8 changed files with 14 additions and 12 deletions

View File

@ -11,8 +11,8 @@ import (
"github.com/urfave/cli/v2"
)
// ValidateRecipeArg ensures the recipe arg is valid.
func ValidateRecipeArg(c *cli.Context) string {
// ValidateRecipe ensures the recipe arg is valid.
func ValidateRecipe(c *cli.Context) string {
recipeName := c.Args().First()
if recipeName == "" {
@ -21,6 +21,7 @@ func ValidateRecipeArg(c *cli.Context) string {
if err := recipe.EnsureExists(recipeName); err != nil {
logrus.Fatal(err)
os.Exit(1)
}
return recipeName