mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-01 14:55:12 +08:00
ea22c2f0a7
Replace the samber/do runtime container with explicit constructor dependencies and generated Wire graphs for ace and cli. Keep CLI application loading isolated and verify generated files in CI.
70 lines
1.6 KiB
Go
70 lines
1.6 KiB
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/leonelquinteros/gotext"
|
|
"github.com/urfave/cli/v3"
|
|
|
|
"github.com/acepanel/panel/v3/internal/service"
|
|
)
|
|
|
|
// RestoreCommand 数据恢复命令组
|
|
func RestoreCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
|
|
|
|
return &cli.Command{
|
|
Name: "restore",
|
|
Usage: t.Get("Data restore"),
|
|
Commands: []*cli.Command{
|
|
{
|
|
Name: "website",
|
|
Usage: t.Get("Restore website backup"),
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "name",
|
|
Aliases: []string{"n"},
|
|
Usage: t.Get("Website name"),
|
|
Required: true,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "file",
|
|
Aliases: []string{"f"},
|
|
Usage: t.Get("Backup file (absolute path or filename under default backup path)"),
|
|
Required: true,
|
|
},
|
|
},
|
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
return cliService.RestoreWebsite(ctx, cmd)
|
|
},
|
|
},
|
|
{
|
|
Name: "database",
|
|
Usage: t.Get("Restore database backup"),
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "type",
|
|
Aliases: []string{"t"},
|
|
Usage: t.Get("Database type"),
|
|
Required: true,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "name",
|
|
Aliases: []string{"n"},
|
|
Usage: t.Get("Database name"),
|
|
Required: true,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "file",
|
|
Aliases: []string{"f"},
|
|
Usage: t.Get("Backup file (absolute path or filename under default backup path)"),
|
|
Required: true,
|
|
},
|
|
},
|
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
return cliService.RestoreDatabase(ctx, cmd)
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|