refactor: 命令树移入 internal/cli,去掉 DefaultRun 注入
- cmd/server/cmd → internal/cli,与 internal/api、internal/proxy 平级 - serve() 移入 cli 包作为默认子命令,main.go 退化为纯入口 - 消除 cmd/cmd 冗余层级和 main → cmd 的回调注入
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// Package cli 命令行入口(Cobra 子命令分发)。
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Execute 启动根命令。
|
||||
func Execute() {
|
||||
cobra.CheckErr(rootCmd.Execute())
|
||||
}
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "openteam",
|
||||
Short: "openteam · LLM API 中转站",
|
||||
Long: `openteam 大模型中转站 API 服务。
|
||||
|
||||
直接运行(无子命令)启动 HTTP 服务:
|
||||
go run ./cmd/server
|
||||
|
||||
子命令:
|
||||
reset-admin-password 重置管理员密码(交互式,无参数时自动提示)`,
|
||||
RunE: func(c *cobra.Command, args []string) error {
|
||||
return serve()
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user