refactor: urfave v3

This commit is contained in:
2024-07-09 13:57:54 +02:00
parent 16aeb441e7
commit ca37621ce3
46 changed files with 405 additions and 345 deletions

View File

@ -1,12 +1,14 @@
package recipe
import (
"context"
"coopcloud.tech/abra/cli/internal"
"coopcloud.tech/abra/pkg/autocomplete"
"coopcloud.tech/abra/pkg/formatter"
"coopcloud.tech/abra/pkg/log"
"coopcloud.tech/abra/pkg/recipe"
"github.com/urfave/cli/v2"
"github.com/urfave/cli/v3"
)
var recipeFetchCommand = cli.Command{
@ -20,13 +22,14 @@ var recipeFetchCommand = cli.Command{
internal.NoInputFlag,
internal.OfflineFlag,
},
Before: internal.SubCommandBefore,
BashComplete: autocomplete.RecipeNameComplete,
Action: func(c *cli.Context) error {
recipeName := c.Args().First()
Before: internal.SubCommandBefore,
EnableShellCompletion: true,
ShellComplete: autocomplete.RecipeNameComplete,
Action: func(ctx context.Context, cmd *cli.Command) error {
recipeName := cmd.Args().First()
r := recipe.Get(recipeName)
if recipeName != "" {
internal.ValidateRecipe(c)
internal.ValidateRecipe(cmd)
if err := r.Ensure(false, false); err != nil {
log.Fatal(err)
}