forked from toolshed/abra
refactor: centralise recipe validation
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package recipe
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
@ -20,10 +19,7 @@ var recipeCreateCommand = &cli.Command{
|
||||
Aliases: []string{"c"},
|
||||
ArgsUsage: "<recipe>",
|
||||
Action: func(c *cli.Context) error {
|
||||
recipe := c.Args().First()
|
||||
if recipe == "" {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("no recipe provided"))
|
||||
}
|
||||
recipe := internal.ValidateRecipe(c)
|
||||
|
||||
directory := path.Join(config.APPS_DIR, recipe)
|
||||
if _, err := os.Stat(directory); !os.IsNotExist(err) {
|
||||
|
Reference in New Issue
Block a user