Files
panel/internal/command/service.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

59 lines
1.4 KiB
Go

package command
import (
"context"
"github.com/leonelquinteros/gotext"
"github.com/urfave/cli/v3"
"github.com/acepanel/panel/v3/internal/service"
)
// StatusCommand 查询服务状态
func StatusCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
return &cli.Command{
Name: "status",
Usage: t.Get("Get AcePanel service status"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.Status(ctx, cmd)
},
}
}
// RestartCommand 重启服务
func RestartCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
return &cli.Command{
Name: "restart",
Usage: t.Get("Restart AcePanel service"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.Restart(ctx, cmd)
},
}
}
// StopCommand 停止服务
func StopCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
return &cli.Command{
Name: "stop",
Usage: t.Get("Stop AcePanel service"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.Stop(ctx, cmd)
},
}
}
// StartCommand 启动服务
func StartCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
return &cli.Command{
Name: "start",
Usage: t.Get("Start AcePanel service"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.Start(ctx, cmd)
},
}
}