refactor: 整理结构和 maker 构建方式

This commit is contained in:
zhaoyupeng
2025-11-27 11:06:38 +08:00
parent 11523e3e48
commit fdad0eb36c
63 changed files with 137 additions and 153 deletions

View File

@@ -3,6 +3,7 @@ package makecmd
import (
"github.com/spf13/cobra"
"yizhisec.com/hsv2/forge/internal/controller/maker"
"yizhisec.com/hsv2/forge/internal/opt"
)
func App() *cobra.Command {
@@ -32,7 +33,7 @@ func appUser() *cobra.Command {
Use: "user",
Short: "Make User App",
RunE: func(cmd *cobra.Command, args []string) error {
mk := maker.NewMaker()
mk := maker.NewMaker(opt.Cfg.Make.Dir)
return mk.AppUser(cmd.Context(), replica)
},
}
@@ -51,7 +52,7 @@ func appClient() *cobra.Command {
Use: "client",
Short: "Make Client App",
RunE: func(cmd *cobra.Command, args []string) error {
mk := maker.NewMaker()
mk := maker.NewMaker(opt.Cfg.Make.Dir)
return mk.AppClient(cmd.Context(), replica)
},
}
@@ -70,7 +71,7 @@ func appGateway() *cobra.Command {
Use: "gateway",
Short: "Make Gateway App",
RunE: func(cmd *cobra.Command, args []string) error {
mk := maker.NewMaker()
mk := maker.NewMaker(opt.Cfg.Make.Dir)
return mk.AppGateway(cmd.Context(), replica)
},
}
@@ -89,7 +90,7 @@ func appMie() *cobra.Command {
Use: "mie",
Short: "Make Mie App",
RunE: func(cmd *cobra.Command, args []string) error {
mk := maker.NewMaker()
mk := maker.NewMaker(opt.Cfg.Make.Dir)
return mk.AppMie(cmd.Context(), replica)
},
}
@@ -109,7 +110,7 @@ func appOEM() *cobra.Command {
Use: "oem",
Short: "Make OEM App",
RunE: func(cmd *cobra.Command, args []string) error {
mk := maker.NewMaker()
mk := maker.NewMaker(opt.Cfg.Make.Dir)
return mk.AppOEM(cmd.Context(), replica, vendor)
},
}
@@ -136,7 +137,7 @@ func appNginx() *cobra.Command {
if disableSeafile {
opts = append(opts, maker.WithoutNginxSeafile())
}
mk := maker.NewMaker()
mk := maker.NewMaker(opt.Cfg.Make.Dir)
return mk.AppNginx(cmd.Context(), opts...)
},
}