fix: add complete for app run command
continuous-integration/drone/push Build is failing Details

This commit is contained in:
decentral1se 2021-09-11 11:51:25 +02:00
parent 9fcdc45851
commit 59c55c0a2f
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 18 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"coopcloud.tech/abra/cli/internal"
"coopcloud.tech/abra/pkg/client"
"coopcloud.tech/abra/pkg/client/container"
"coopcloud.tech/abra/pkg/config"
"github.com/docker/cli/cli/command"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/filters"
@ -42,7 +43,11 @@ var appRunCommand = &cli.Command{
app := internal.ValidateApp(c)
if c.Args().Len() < 2 {
internal.ShowSubcommandHelpAndError(c, errors.New("no <service> provided"))
internal.ShowSubcommandHelpAndError(c, errors.New("no <service> provided?"))
}
if c.Args().Len() < 3 {
internal.ShowSubcommandHelpAndError(c, errors.New("no <args> provided?"))
}
ctx := context.Background()
@ -96,4 +101,16 @@ var appRunCommand = &cli.Command{
return nil
},
BashComplete: func(c *cli.Context) {
appNames, err := config.GetAppNames()
if err != nil {
return
}
if c.NArg() > 0 {
return
}
for _, a := range appNames {
fmt.Println(a)
}
},
}