fix: add autocomplete for app run
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
5cacd09a04
commit
a700aca23d
@ -5,8 +5,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
containerPkg "coopcloud.tech/abra/pkg/container"
|
||||
"coopcloud.tech/abra/pkg/upstream/container"
|
||||
"github.com/docker/cli/cli/command"
|
||||
@ -36,9 +36,10 @@ var appRunCommand = &cli.Command{
|
||||
noTTYFlag,
|
||||
userFlag,
|
||||
},
|
||||
Aliases: []string{"r"},
|
||||
ArgsUsage: "<service> <args>...",
|
||||
Usage: "Run a command in a service container",
|
||||
Aliases: []string{"r"},
|
||||
ArgsUsage: "<service> <args>...",
|
||||
Usage: "Run a command in a service container",
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
|
||||
@ -94,25 +95,4 @@ var appRunCommand = &cli.Command{
|
||||
|
||||
return nil
|
||||
},
|
||||
BashComplete: func(c *cli.Context) {
|
||||
switch c.NArg() {
|
||||
case 0:
|
||||
appNames, err := config.GetAppNames()
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
for _, a := range appNames {
|
||||
fmt.Println(a)
|
||||
}
|
||||
case 1:
|
||||
appName := c.Args().First()
|
||||
serviceNames, err := config.GetAppServiceNames(appName)
|
||||
if err != nil {
|
||||
logrus.Warn(err)
|
||||
}
|
||||
for _, s := range serviceNames {
|
||||
fmt.Println(s)
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user