forked from toolshed/abra
refactor!: migrate to urfave/cli v1
Better flexible flags handling.
This commit is contained in:
@ -12,28 +12,31 @@ import (
|
||||
"coopcloud.tech/abra/cli/internal"
|
||||
"coopcloud.tech/abra/pkg/config"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var restoreAllServices bool
|
||||
var restoreAllServicesFlag = &cli.BoolFlag{
|
||||
Name: "all",
|
||||
Value: false,
|
||||
Name: "all, a",
|
||||
Destination: &restoreAllServices,
|
||||
Aliases: []string{"a"},
|
||||
Usage: "Restore all services",
|
||||
}
|
||||
|
||||
var appRestoreCommand = &cli.Command{
|
||||
Name: "restore",
|
||||
Usage: "Restore an app from a backup",
|
||||
Aliases: []string{"rs"},
|
||||
Flags: []cli.Flag{restoreAllServicesFlag},
|
||||
var appRestoreCommand = cli.Command{
|
||||
Name: "restore",
|
||||
Aliases: []string{"rs"},
|
||||
Usage: "Restore an app from a backup",
|
||||
Flags: []cli.Flag{
|
||||
internal.DebugFlag,
|
||||
internal.NoInputFlag,
|
||||
restoreAllServicesFlag,
|
||||
},
|
||||
Before: internal.SubCommandBefore,
|
||||
ArgsUsage: "<service> [<backup file>]",
|
||||
Action: func(c *cli.Context) error {
|
||||
app := internal.ValidateApp(c)
|
||||
|
||||
if c.Args().Len() > 1 && restoreAllServices {
|
||||
if len(c.Args()) > 1 && restoreAllServices {
|
||||
internal.ShowSubcommandHelpAndError(c, errors.New("cannot use <service>/<backup file> and '--all' together"))
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user