forked from toolshed/abra
fix: ensure latest checked out for recipe upgrade
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user