forked from toolshed/abra
refactor(recipe): use new recipe.Ensure method
This commit is contained in:
@ -28,28 +28,12 @@ var recipeLintCommand = cli.Command{
|
||||
BashComplete: autocomplete.RecipeNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipe := internal.ValidateRecipe(c)
|
||||
|
||||
r := recipePkg.Get2(recipe.Name)
|
||||
|
||||
if err := r.EnsureExists(); err != nil {
|
||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if !internal.Chaos {
|
||||
if err := r.EnsureIsClean(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if !internal.Offline {
|
||||
if err := r.EnsureUpToDate(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
if err := r.EnsureLatest(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
tableCol := []string{"ref", "rule", "severity", "satisfied", "skipped", "resolve"}
|
||||
table := formatter.CreateTable(tableCol)
|
||||
|
||||
|
@ -72,21 +72,9 @@ You may invoke this command in "wizard" mode and be prompted for input:
|
||||
BashComplete: autocomplete.RecipeNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
recipe := internal.ValidateRecipe(c)
|
||||
|
||||
r := recipePkg.Get2(recipe.Name)
|
||||
|
||||
if err := r.EnsureIsClean(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := r.EnsureExists(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := r.EnsureUpToDate(); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if err := r.EnsureLatest(); err != nil {
|
||||
if err := r.Ensure(internal.Chaos, internal.Offline); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user