forked from toolshed/abra
refactor: urfave v3
This commit is contained in:
@ -1,22 +1,23 @@
|
||||
package autocomplete
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"coopcloud.tech/abra/pkg/app"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"coopcloud.tech/abra/pkg/recipe"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
// AppNameComplete copletes app names.
|
||||
func AppNameComplete(c *cli.Context) {
|
||||
func AppNameComplete(ctx context.Context, cmd *cli.Command) {
|
||||
appNames, err := app.GetAppNames()
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
}
|
||||
|
||||
if c.NArg() > 0 {
|
||||
if cmd.NArg() > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@ -36,13 +37,13 @@ func ServiceNameComplete(appName string) {
|
||||
}
|
||||
|
||||
// RecipeNameComplete completes recipe names.
|
||||
func RecipeNameComplete(c *cli.Context) {
|
||||
func RecipeNameComplete(ctx context.Context, cmd *cli.Command) {
|
||||
catl, err := recipe.ReadRecipeCatalogue(false)
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
}
|
||||
|
||||
if c.NArg() > 0 {
|
||||
if cmd.NArg() > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@ -66,13 +67,13 @@ func RecipeVersionComplete(recipeName string) {
|
||||
}
|
||||
|
||||
// ServerNameComplete completes server names.
|
||||
func ServerNameComplete(c *cli.Context) {
|
||||
func ServerNameComplete(ctx context.Context, cmd *cli.Command) {
|
||||
files, err := app.LoadAppFiles("")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if c.NArg() > 0 {
|
||||
if cmd.NArg() > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
@ -82,8 +83,8 @@ func ServerNameComplete(c *cli.Context) {
|
||||
}
|
||||
|
||||
// SubcommandComplete completes sub-commands.
|
||||
func SubcommandComplete(c *cli.Context) {
|
||||
if c.NArg() > 0 {
|
||||
func SubcommandComplete(ctx context.Context, cmd *cli.Command) {
|
||||
if cmd.NArg() > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user