forked from toolshed/abra
refactor: urfave v3
This commit is contained in:
@ -9,7 +9,7 @@ import (
|
||||
"coopcloud.tech/abra/pkg/formatter"
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
var allFilter bool
|
||||
@ -31,26 +31,23 @@ var volumesFilterFlag = &cli.BoolFlag{
|
||||
}
|
||||
|
||||
var serverPruneCommand = cli.Command{
|
||||
Name: "prune",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "Prune resources on a server",
|
||||
Description: `
|
||||
Prunes unused containers, networks, and dangling images.
|
||||
Name: "prune",
|
||||
Aliases: []string{"p"},
|
||||
Usage: "Prune resources on a server",
|
||||
UsageText: "abra server prune <server> [options]",
|
||||
Description: `Prunes unused containers, networks, and dangling images.
|
||||
|
||||
Use "-v/--volumes" to remove volumes that are not associated with a deployed
|
||||
app. This can result in unwanted data loss if not used carefully.`,
|
||||
ArgsUsage: "[<server>]",
|
||||
Flags: []cli.Flag{
|
||||
allFilterFlag,
|
||||
volumesFilterFlag,
|
||||
internal.DebugFlag,
|
||||
internal.OfflineFlag,
|
||||
internal.NoInputFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
BashComplete: autocomplete.ServerNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
serverName := internal.ValidateServer(c)
|
||||
Before: internal.SubCommandBefore,
|
||||
ShellComplete: autocomplete.ServerNameComplete,
|
||||
HideHelp: true,
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
serverName := internal.ValidateServer(cmd)
|
||||
|
||||
cl, err := client.New(serverName)
|
||||
if err != nil {
|
||||
@ -59,7 +56,6 @@ app. This can result in unwanted data loss if not used carefully.`,
|
||||
|
||||
var args filters.Args
|
||||
|
||||
ctx := context.Background()
|
||||
cr, err := cl.ContainersPrune(ctx, args)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
Reference in New Issue
Block a user