mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-01 14:55:12 +08:00
e8f7811aba
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>
50 lines
2.6 KiB
Go
50 lines
2.6 KiB
Go
package bootstrap
|
||
|
||
import (
|
||
"strings"
|
||
|
||
"github.com/leonelquinteros/gotext"
|
||
"github.com/urfave/cli/v3"
|
||
|
||
"github.com/acepanel/panel/v3/internal/app"
|
||
)
|
||
|
||
func NewCli(t *gotext.Locale, commands []*cli.Command) *cli.Command {
|
||
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "NAME", t.Get("NAME"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "USAGE", t.Get("USAGE"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "VERSION", t.Get("VERSION"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "DESCRIPTION", t.Get("DESCRIPTION"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "AUTHOR", t.Get("AUTHOR"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "COMMANDS", t.Get("COMMANDS"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "GLOBAL OPTIONS", t.Get("GLOBAL OPTIONS"))
|
||
cli.RootCommandHelpTemplate = strings.ReplaceAll(cli.RootCommandHelpTemplate, "COPYRIGHT", t.Get("COPYRIGHT"))
|
||
cli.CommandHelpTemplate = strings.ReplaceAll(cli.CommandHelpTemplate, "NAME", t.Get("NAME"))
|
||
cli.CommandHelpTemplate = strings.ReplaceAll(cli.CommandHelpTemplate, "USAGE", t.Get("USAGE"))
|
||
cli.CommandHelpTemplate = strings.ReplaceAll(cli.CommandHelpTemplate, "CATEGORY", t.Get("CATEGORY"))
|
||
cli.CommandHelpTemplate = strings.ReplaceAll(cli.CommandHelpTemplate, "DESCRIPTION", t.Get("DESCRIPTION"))
|
||
cli.CommandHelpTemplate = strings.ReplaceAll(cli.CommandHelpTemplate, "OPTIONS", t.Get("OPTIONS"))
|
||
cli.SubcommandHelpTemplate = strings.ReplaceAll(cli.SubcommandHelpTemplate, "NAME", t.Get("NAME"))
|
||
cli.SubcommandHelpTemplate = strings.ReplaceAll(cli.SubcommandHelpTemplate, "USAGE", t.Get("USAGE"))
|
||
cli.SubcommandHelpTemplate = strings.ReplaceAll(cli.SubcommandHelpTemplate, "DESCRIPTION", t.Get("USAGE"))
|
||
cli.SubcommandHelpTemplate = strings.ReplaceAll(cli.SubcommandHelpTemplate, "COMMANDS", t.Get("COMMANDS"))
|
||
cli.SubcommandHelpTemplate = strings.ReplaceAll(cli.SubcommandHelpTemplate, "OPTIONS", t.Get("OPTIONS"))
|
||
|
||
cli.RootCommandHelpTemplate += "\n" + t.Get("Website:https://acepanel.net")
|
||
cli.RootCommandHelpTemplate += "\n" + t.Get("Forum:https://tom.moe")
|
||
cli.RootCommandHelpTemplate += "\n" + t.Get("QQ Group:12370907") + "\n"
|
||
|
||
return &cli.Command{
|
||
Name: "acepanel",
|
||
Usage: t.Get("AcePanel CLI Tool"),
|
||
Version: app.Version,
|
||
Flags: []cli.Flag{
|
||
&cli.BoolFlag{
|
||
Name: "json",
|
||
Usage: t.Get("Output in JSON format (list commands only)"),
|
||
},
|
||
},
|
||
Commands: commands,
|
||
}
|
||
}
|