0
0
forked from toolshed/abra

WIP: make "abra app deploy" callable by code

Closes coop-cloud/organising#212.
This commit is contained in:
2021-11-03 09:20:40 +01:00
parent 911f22233f
commit c227972c12
8 changed files with 210 additions and 189 deletions

View File

@ -13,6 +13,9 @@ import (
"github.com/urfave/cli/v2"
)
// AppName is used for configuring app name programmatically
var AppName string
// ValidateRecipe ensures the recipe arg is valid.
func ValidateRecipe(c *cli.Context) recipe.Recipe {
recipeName := c.Args().First()
@ -59,7 +62,7 @@ func ValidateRecipeWithPrompt(c *cli.Context) recipe.Recipe {
logrus.Debugf("programmatically setting recipe name to %s", recipeName)
}
if recipeName == "" && RecipeName == "" {
if recipeName == "" {
ShowSubcommandHelpAndError(c, errors.New("no recipe provided"))
}
@ -77,6 +80,11 @@ func ValidateRecipeWithPrompt(c *cli.Context) recipe.Recipe {
func ValidateApp(c *cli.Context) config.App {
appName := c.Args().First()
if appName == "" && AppName != "" {
appName = AppName
logrus.Debugf("programmatically setting app name to %s", appName)
}
if appName == "" {
ShowSubcommandHelpAndError(c, errors.New("no app provided"))
}