forked from toolshed/abra
refactor: urfave v3
This commit is contained in:
@ -12,41 +12,35 @@ import (
|
||||
"coopcloud.tech/abra/pkg/log"
|
||||
upstream "coopcloud.tech/abra/pkg/upstream/service"
|
||||
stack "coopcloud.tech/abra/pkg/upstream/stack"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/urfave/cli/v3"
|
||||
)
|
||||
|
||||
var appRestartCommand = cli.Command{
|
||||
Name: "restart",
|
||||
Aliases: []string{"re"},
|
||||
Usage: "Restart an app",
|
||||
ArgsUsage: "<domain> [<service>]",
|
||||
UsageText: "abra app restart <domain> [<service>] [options]",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.OfflineFlag,
|
||||
internal.AllServicesFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
Description: `
|
||||
This command restarts services within a deployed app.
|
||||
Description: `This command restarts services within a deployed app.
|
||||
|
||||
Run "abra app ps <domain>" to see a list of service names.
|
||||
|
||||
Pass "--all-services/-a" to restart all services.
|
||||
|
||||
EXAMPLE:
|
||||
|
||||
abra app restart example.com app`,
|
||||
BashComplete: autocomplete.AppNameComplete,
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
Pass "--all-services/-a" to restart all services.`,
|
||||
ShellComplete: autocomplete.AppNameComplete,
|
||||
HideHelp: true,
|
||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||
app := internal.ValidateApp(cmd)
|
||||
if err := app.Recipe.Ensure(false, false); err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
serviceName := c.Args().Get(1)
|
||||
serviceName := cmd.Args().Get(1)
|
||||
if serviceName == "" && !internal.AllServices {
|
||||
err := errors.New("missing <service>")
|
||||
internal.ShowSubcommandHelpAndError(c, err)
|
||||
internal.ShowSubcommandHelpAndError(cmd, err)
|
||||
}
|
||||
|
||||
if serviceName != "" && internal.AllServices {
|
||||
|
Reference in New Issue
Block a user