Files
panel/internal/command/website.go
T
耗子 ea22c2f0a7 refactor(di): restore compile-time Wire injection
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.
2026-07-27 02:54:44 +08:00

95 lines
2.4 KiB
Go

package command
import (
"context"
"github.com/leonelquinteros/gotext"
"github.com/urfave/cli/v3"
"github.com/acepanel/panel/v3/internal/service"
)
// WebsiteCommand 网站管理命令组
func WebsiteCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
return &cli.Command{
Name: "website",
Usage: t.Get("Website management"),
Commands: []*cli.Command{
{
Name: "create",
Usage: t.Get("Create new website"),
Flags: []cli.Flag{
&cli.StringFlag{
Name: "name",
Usage: t.Get("Website name"),
Aliases: []string{"n"},
Required: true,
},
&cli.StringSliceFlag{
Name: "domains",
Usage: t.Get("List of domains associated with the website"),
Aliases: []string{"d"},
Required: true,
},
&cli.StringSliceFlag{
Name: "listens",
Usage: t.Get("List of listening addresses associated with the website"),
Aliases: []string{"l"},
Required: true,
},
&cli.StringFlag{
Name: "path",
Usage: t.Get("Path where the website is hosted (default path if not filled)"),
},
&cli.UintFlag{
Name: "php",
Usage: t.Get("PHP version used by the website (not used if not filled)"),
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.WebsiteCreate(ctx, cmd)
},
},
{
Name: "remove",
Usage: t.Get("Remove website"),
Flags: []cli.Flag{
&cli.StringFlag{
Name: "name",
Usage: t.Get("Website name"),
Aliases: []string{"n"},
Required: true,
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.WebsiteRemove(ctx, cmd)
},
},
{
Name: "delete",
Usage: t.Get("Delete website (including website directory, database with the same name)"),
Flags: []cli.Flag{
&cli.StringFlag{
Name: "name",
Usage: t.Get("Website name"),
Aliases: []string{"n"},
Required: true,
},
},
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.WebsiteDelete(ctx, cmd)
},
},
{
Name: "write",
Usage: t.Get("Write website data (use only under guidance)"),
Hidden: true,
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.WebsiteWrite(ctx, cmd)
},
},
},
}
}