forked from toolshed/abra
.gitea
cli
cmd
pkg
app
autocomplete
autocomplete.go
catalogue
client
compose
config
container
context
dns
git
limit
recipe
secret
server
ssh
upstream
web
scripts
tests
.drone.yml
.envrc.sample
.gitignore
.goreleaser.yml
Makefile
README.md
go.mod
go.sum
renovate.json
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)
|
|
}
|
|
}
|