🏗️ move make sub-cmd to sub-dir
This commit is contained in:
36
internal/cmd/makecmd/es.go
Normal file
36
internal/cmd/makecmd/es.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package makecmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"yizhisec.com/hsv2/forge/internal/controller/maker"
|
||||
)
|
||||
|
||||
func ES() *cobra.Command {
|
||||
var (
|
||||
makeHelper bool
|
||||
memRate int
|
||||
storage int
|
||||
)
|
||||
|
||||
_cmd := &cobra.Command{
|
||||
Use: "es",
|
||||
Aliases: []string{"elastic", "elasticsearch"},
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
mk := maker.NewMaker()
|
||||
return mk.Elastic(
|
||||
cmd.Context(),
|
||||
maker.WithElasticMakeHelper(makeHelper),
|
||||
maker.WithElasticMemRate(memRate),
|
||||
maker.WithElasticStorageGi(fmt.Sprintf("%dGi", storage)),
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
_cmd.Flags().BoolVar(&makeHelper, "make-helper", false, "重新构建 helper 镜像")
|
||||
_cmd.Flags().IntVar(&memRate, "mem-rate", 1, "内存倍率(从 1G 开始)")
|
||||
_cmd.Flags().IntVar(&storage, "storage-size", 100, "存储空间(单位: G)")
|
||||
|
||||
return _cmd
|
||||
}
|
||||
Reference in New Issue
Block a user