fix: initial subcmd completion
continuous-integration/drone/pr Build is passing Details
continuous-integration/drone/push Build is passing Details

Broken by migration to v1 API.
This commit is contained in:
decentral1se 2022-01-20 11:42:04 +01:00
parent cff7534bf9
commit c7062e0494
Signed by: decentral1se
GPG Key ID: 03789458B3D0C410
2 changed files with 23 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import (
"coopcloud.tech/abra/cli/recipe"
"coopcloud.tech/abra/cli/record"
"coopcloud.tech/abra/cli/server"
"coopcloud.tech/abra/pkg/autocomplete"
"coopcloud.tech/abra/pkg/config"
"coopcloud.tech/abra/pkg/web"
"github.com/sirupsen/logrus"
@ -162,6 +163,7 @@ func newAbraApp(version, commit string) *cli.App {
UpgradeCommand,
AutoCompleteCommand,
},
BashComplete: autocomplete.SubcommandComplete,
Authors: []cli.Author{
// If you're looking at this and you hack on Abra and you're not listed
// here, please do add yourself! This is a community project, let's show

View File

@ -40,3 +40,24 @@ func RecipeNameComplete(c *cli.Context) {
fmt.Println(name)
}
}
// SubcommandComplete completes subcommands.
func SubcommandComplete(c *cli.Context) {
if c.NArg() > 0 {
return
}
subcmds := []string{
"app",
"autocomplete",
"catalogue",
"recipe",
"record",
"server",
"upgrade",
}
for _, cmd := range subcmds {
fmt.Println(cmd)
}
}