Files
complie-erlang/cmd/mod.go
T

44 lines
723 B
Go

package cmd
import (
"complie-erlang/worker"
"fmt"
"github.com/spf13/cobra"
"log"
)
type modSet struct{}
func (m *modSet) run(cmd *cobra.Command, args []string) {
if len(args) == 0 {
_ = cmd.Help()
return
}
modName := args[0]
modArgs := args[1:]
if err := worker.ModWorkerRun(modName, modArgs); err != nil {
log.Printf("[error] mod worker run error: %v", err)
}
fmt.Printf("ok \n")
}
func init() {
var singleSet = new(modSet)
var singleCmd = &cobra.Command{
Use: "mod",
Short: "根据约定模板生成 多个文件构建 功能模版",
Long: `
- 根据约定模板生成
mod activity activity_test.proto
mod func test1.proto
`,
Run: singleSet.run,
}
rootCmd.AddCommand(singleCmd)
}