🏗️ move make sub-cmd to sub-dir

This commit is contained in:
zhaoyupeng
2025-11-25 15:46:28 +08:00
parent 454e0639a0
commit 62b680dca8
27 changed files with 750 additions and 105 deletions

View File

@@ -1,36 +0,0 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"yizhisec.com/hsv2/forge/internal/controller/maker"
)
func makeMysql() *cobra.Command {
var (
replicas int
storage int
)
_cmd := &cobra.Command{
Use: "mysql",
Short: "Build MySQL resources",
Long: `Build and prepare MySQL database resources.`,
RunE: func(cmd *cobra.Command, args []string) error {
opts := []maker.MysqlOpt{
maker.WithMySQLReplica(replicas),
maker.WithMySQLStorage(fmt.Sprintf("%dGi", storage)),
}
mk := maker.NewMaker()
return mk.MySQL(cmd.Context(), opts...)
},
}
_cmd.Flags().IntVar(&replicas, "replica-count", 2, "mysql 的副本数")
_cmd.Flags().IntVar(&storage, "storage-size", 50, "mysql 的存储空间(GB)")
return _cmd
}