Files
panel/internal/command/app.go
T
耗子 e8f7811aba feat: 重构 CLI 命令并补全缺失功能
website create 未传网站类型导致必然失败,补全类型、代理地址、
数据库、备注等参数,并在进入 biz 层前统一走验证器校验。

新增命令:
- firewall status/on/off/list/port
- cert list/renew
- restore panel
- website cert/list,user create/delete
- backup list,app list,cron list/run/status
- database list-server

调整:
- 密码取值改为参数 > ACEPANEL_PASSWORD > 交互输入(不回显)
- 补 bind-domain/bind-ip/bind-ua 的 on 子命令
- 新增全局 --json,接入全部 list 命令
- port 支持 flag 写法,info 支持 -u 指定用户
- 位置参数命令补 ArgsUsage

修复:
- cutoff clear 清理远程日志时目录与上传路径不一致,导致远程切割
  日志从未被清理,ClearStorageExpired 改为接收目标目录
- restore 缺少 panel 分支,从 FixPanel 抽出 restorePanel 复用

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 19:30:11 +08:00

71 lines
1.8 KiB
Go

package command
import (
"context"
"github.com/leonelquinteros/gotext"
"github.com/urfave/cli/v3"
"github.com/acepanel/panel/v3/internal/service"
)
// AppCommand 应用管理命令组
func AppCommand(t *gotext.Locale, cliService *service.CliService) *cli.Command {
return &cli.Command{
Name: "app",
Usage: t.Get("Application management"),
Commands: []*cli.Command{
{
Name: "install",
Usage: t.Get("Install application"),
ArgsUsage: t.Get("<slug> [channel]"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.AppInstall(ctx, cmd)
},
},
{
Name: "uninstall",
Usage: t.Get("Uninstall application"),
ArgsUsage: t.Get("<slug>"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.AppUnInstall(ctx, cmd)
},
},
{
Name: "update",
Usage: t.Get("Update application"),
ArgsUsage: t.Get("<slug>"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.AppUpdate(ctx, cmd)
},
},
{
Name: "list",
Usage: t.Get("List installed applications"),
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.AppList(ctx, cmd)
},
},
{
Name: "write",
Usage: t.Get("Add panel application mark (use only under guidance)"),
ArgsUsage: t.Get("<slug> <channel> <version>"),
Hidden: true,
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.AppWrite(ctx, cmd)
},
},
{
Name: "remove",
Usage: t.Get("Remove panel application mark (use only under guidance)"),
ArgsUsage: t.Get("<slug>"),
Hidden: true,
Action: func(ctx context.Context, cmd *cli.Command) error {
return cliService.AppRemove(ctx, cmd)
},
},
},
}
}