goc/cmd/build.go

25 lines
535 B
Go
Raw Normal View History

2021-04-04 03:42:05 +00:00
package cmd
import (
2021-05-23 14:23:35 +00:00
"github.com/qiniu/goc/v2/pkg/build"
2021-06-14 07:18:29 +00:00
"github.com/qiniu/goc/v2/pkg/config"
2021-04-04 03:42:05 +00:00
"github.com/spf13/cobra"
)
var buildCmd = &cobra.Command{
Use: "build",
2021-05-23 14:23:35 +00:00
Run: buildAction,
2021-04-19 02:18:37 +00:00
DisableFlagParsing: true, // build 命令需要用原生 go 的方式处理 flags
2021-04-04 03:42:05 +00:00
}
func init() {
2021-06-14 07:18:29 +00:00
buildCmd.Flags().StringVarP(&config.GocConfig.Mode, "mode", "", "count", "coverage mode: set, count, atomic")
2021-04-04 03:42:05 +00:00
rootCmd.AddCommand(buildCmd)
}
2021-04-19 02:18:37 +00:00
2021-05-23 14:23:35 +00:00
func buildAction(cmd *cobra.Command, args []string) {
b := build.NewBuild(cmd, args)
b.Build()
2021-04-19 02:18:37 +00:00
}