forked from toolshed/abra
refactor: autocomplete package
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
abraFormatter "coopcloud.tech/abra/cli/formatter"
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/autocomplete"
|
||||
"coopcloud.tech/abra/pkg/client"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"github.com/docker/cli/cli/command/formatter"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
@ -33,6 +32,7 @@ var appPsCommand = &cli.Command{
|
||||
Flags: []cli.Flag{
|
||||
watchFlag,
|
||||
},
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
if !watch {
|
||||
showPSOutput(c)
|
||||
@ -45,18 +45,6 @@ var appPsCommand = &cli.Command{
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
},
|
||||
BashComplete: func(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)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
// showPSOutput renders ps output.
|
||||
|
Reference in New Issue
Block a user