2021-12-11 23:17:39 +00:00
|
|
|
package autocomplete
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"coopcloud.tech/abra/pkg/config"
|
2021-12-27 15:40:59 +00:00
|
|
|
"coopcloud.tech/abra/pkg/recipe"
|
2021-12-11 23:17:39 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2022-01-18 13:13:20 +00:00
|
|
|
"github.com/urfave/cli"
|
2021-12-11 23:17:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// AppNameComplete copletes app names
|
|
|
|
func AppNameComplete(c *cli.Context) {
|
|
|
|
appNames, err := config.GetAppNames()
|
|
|
|
if err != nil {
|
|
|
|
logrus.Warn(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.NArg() > 0 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, a := range appNames {
|
|
|
|
fmt.Println(a)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RecipeNameComplete completes recipe names
|
|
|
|
func RecipeNameComplete(c *cli.Context) {
|
2021-12-27 15:40:59 +00:00
|
|
|
catl, err := recipe.ReadRecipeCatalogue()
|
2021-12-11 23:17:39 +00:00
|
|
|
if err != nil {
|
|
|
|
logrus.Warn(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if c.NArg() > 0 {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
for name := range catl {
|
|
|
|
fmt.Println(name)
|
|
|
|
}
|
|
|
|
}
|