forked from coop-cloud/abra
43 lines
668 B
Go
43 lines
668 B
Go
|
package autocomplete
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"coopcloud.tech/abra/pkg/catalogue"
|
||
|
"coopcloud.tech/abra/pkg/config"
|
||
|
"github.com/sirupsen/logrus"
|
||
|
"github.com/urfave/cli/v2"
|
||
|
)
|
||
|
|
||
|
// 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) {
|
||
|
catl, err := catalogue.ReadRecipeCatalogue()
|
||
|
if err != nil {
|
||
|
logrus.Warn(err)
|
||
|
}
|
||
|
|
||
|
if c.NArg() > 0 {
|
||
|
return
|
||
|
}
|
||
|
|
||
|
for name := range catl {
|
||
|
fmt.Println(name)
|
||
|
}
|
||
|
}
|