fix: initial subcmd completion
Broken by migration to v1 API.
This commit is contained in:
parent
cff7534bf9
commit
c7062e0494
|
@ -14,6 +14,7 @@ import (
|
||||||
"coopcloud.tech/abra/cli/recipe"
|
"coopcloud.tech/abra/cli/recipe"
|
||||||
"coopcloud.tech/abra/cli/record"
|
"coopcloud.tech/abra/cli/record"
|
||||||
"coopcloud.tech/abra/cli/server"
|
"coopcloud.tech/abra/cli/server"
|
||||||
|
"coopcloud.tech/abra/pkg/autocomplete"
|
||||||
"coopcloud.tech/abra/pkg/config"
|
"coopcloud.tech/abra/pkg/config"
|
||||||
"coopcloud.tech/abra/pkg/web"
|
"coopcloud.tech/abra/pkg/web"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -162,6 +163,7 @@ func newAbraApp(version, commit string) *cli.App {
|
||||||
UpgradeCommand,
|
UpgradeCommand,
|
||||||
AutoCompleteCommand,
|
AutoCompleteCommand,
|
||||||
},
|
},
|
||||||
|
BashComplete: autocomplete.SubcommandComplete,
|
||||||
Authors: []cli.Author{
|
Authors: []cli.Author{
|
||||||
// If you're looking at this and you hack on Abra and you're not listed
|
// 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
|
// here, please do add yourself! This is a community project, let's show
|
||||||
|
|
|
@ -40,3 +40,24 @@ func RecipeNameComplete(c *cli.Context) {
|
||||||
fmt.Println(name)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue