diff --git a/cli/internal/new.go b/cli/internal/new.go index 3d672524..ce3b714f 100644 --- a/cli/internal/new.go +++ b/cli/internal/new.go @@ -91,7 +91,7 @@ func ensureServerFlag() error { // NewAction is the new app creation logic func NewAction(c *cli.Context) error { - recipe := ValidateRecipeWithPrompt(c) + recipe := ValidateRecipeWithPrompt(c, false) if err := recipePkg.EnsureUpToDate(recipe.Name); err != nil { logrus.Fatal(err) diff --git a/cli/internal/validate.go b/cli/internal/validate.go index 1c87904b..56af1375 100644 --- a/cli/internal/validate.go +++ b/cli/internal/validate.go @@ -45,7 +45,7 @@ func ValidateRecipe(c *cli.Context) recipe.Recipe { // ValidateRecipeWithPrompt ensures a recipe argument is present before // validating, asking for input if required. -func ValidateRecipeWithPrompt(c *cli.Context) recipe.Recipe { +func ValidateRecipeWithPrompt(c *cli.Context, ensureLatest bool) recipe.Recipe { recipeName := c.Args().First() if recipeName == "" && !NoInput { @@ -94,6 +94,12 @@ func ValidateRecipeWithPrompt(c *cli.Context) recipe.Recipe { ShowSubcommandHelpAndError(c, errors.New("no recipe name provided")) } + if ensureLatest { + if err := recipe.EnsureLatest(recipeName); err != nil { + logrus.Fatal(err) + } + } + chosenRecipe, err := recipe.Get(recipeName) if err != nil { logrus.Fatal(err) diff --git a/cli/recipe/release.go b/cli/recipe/release.go index 727281e8..05481f2e 100644 --- a/cli/recipe/release.go +++ b/cli/recipe/release.go @@ -59,7 +59,7 @@ your SSH keys configured on your account. Before: internal.SubCommandBefore, BashComplete: autocomplete.RecipeNameComplete, Action: func(c *cli.Context) error { - recipe := internal.ValidateRecipeWithPrompt(c) + recipe := internal.ValidateRecipeWithPrompt(c, false) imagesTmp, err := getImageVersions(recipe) if err != nil { diff --git a/cli/recipe/sync.go b/cli/recipe/sync.go index f6cedb07..74d67c56 100644 --- a/cli/recipe/sync.go +++ b/cli/recipe/sync.go @@ -41,7 +41,7 @@ auto-generate it for you. The configuration will be updated on the local file system. `, Action: func(c *cli.Context) error { - recipe := internal.ValidateRecipeWithPrompt(c) + recipe := internal.ValidateRecipeWithPrompt(c, false) mainApp, err := internal.GetMainAppImage(recipe) if err != nil { diff --git a/cli/recipe/upgrade.go b/cli/recipe/upgrade.go index d2678fb4..d3be2206 100644 --- a/cli/recipe/upgrade.go +++ b/cli/recipe/upgrade.go @@ -60,7 +60,7 @@ You may invoke this command in "wizard" mode and be prompted for input: }, Before: internal.SubCommandBefore, Action: func(c *cli.Context) error { - recipe := internal.ValidateRecipeWithPrompt(c) + recipe := internal.ValidateRecipeWithPrompt(c, true) bumpType := btoi(internal.Major)*4 + btoi(internal.Minor)*2 + btoi(internal.Patch) if bumpType != 0 {