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.
94 lines
2.2 KiB
Go
94 lines
2.2 KiB
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/leonelquinteros/gotext"
|
|
"github.com/urfave/cli/v3"
|
|
|
|
"github.com/acepanel/panel/v3/internal/service"
|
|
)
|
|
|
|
// CutoffCommand 日志切割命令组
|
|
func CutoffCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
|
|
|
|
return &cli.Command{
|
|
Name: "cutoff",
|
|
Usage: t.Get("Log rotation"),
|
|
Commands: []*cli.Command{
|
|
{
|
|
Name: "website",
|
|
Usage: t.Get("Website"),
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "name",
|
|
Aliases: []string{"n"},
|
|
Usage: t.Get("Website name"),
|
|
Required: true,
|
|
},
|
|
&cli.UintFlag{
|
|
Name: "storage",
|
|
Aliases: []string{"s"},
|
|
Usage: t.Get("Storage ID (local storage if not filled)"),
|
|
},
|
|
},
|
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
return cliService.CutoffWebsite(ctx, cmd)
|
|
},
|
|
},
|
|
{
|
|
Name: "container",
|
|
Usage: t.Get("Container"),
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "name",
|
|
Aliases: []string{"n"},
|
|
Usage: t.Get("Container name"),
|
|
Required: true,
|
|
},
|
|
&cli.UintFlag{
|
|
Name: "storage",
|
|
Aliases: []string{"s"},
|
|
Usage: t.Get("Storage ID (local storage if not filled)"),
|
|
},
|
|
},
|
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
return cliService.CutoffContainer(ctx, cmd)
|
|
},
|
|
},
|
|
{
|
|
Name: "clear",
|
|
Usage: t.Get("Clear rotated logs"),
|
|
Flags: []cli.Flag{
|
|
&cli.StringFlag{
|
|
Name: "type",
|
|
Aliases: []string{"t"},
|
|
Usage: t.Get("Rotation type"),
|
|
Required: true,
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "name",
|
|
Aliases: []string{"n"},
|
|
Usage: t.Get("Target name"),
|
|
Required: true,
|
|
},
|
|
&cli.UintFlag{
|
|
Name: "keep",
|
|
Aliases: []string{"k"},
|
|
Usage: t.Get("Number of logs to keep"),
|
|
Required: true,
|
|
},
|
|
&cli.UintFlag{
|
|
Name: "storage",
|
|
Aliases: []string{"s"},
|
|
Usage: t.Get("Storage ID (local storage if not filled)"),
|
|
},
|
|
},
|
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
|
return cliService.CutoffClear(ctx, cmd)
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|