
1. 去掉全局的配置 config 2. 合并 pkg/build, pkg/flag, pkg/cover, pkg/config 几个包(这几个包有强相关性,适合放一处。并且分开也容易造成循环依赖)
29 lines
528 B
Go
29 lines
528 B
Go
package cmd
|
|
|
|
import (
|
|
cli "github.com/qiniu/goc/v2/pkg/watch"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var watchCmd = &cobra.Command{
|
|
Use: "watch",
|
|
Short: "watch for profile's real time update",
|
|
Long: "watch for profile's real time update",
|
|
Example: "",
|
|
|
|
Run: watch,
|
|
}
|
|
|
|
var (
|
|
watchHost string
|
|
)
|
|
|
|
func init() {
|
|
watchCmd.Flags().StringVarP(&watchHost, "host", "", "127.0.0.1:7777", "specify the host of the goc server")
|
|
rootCmd.AddCommand(watchCmd)
|
|
}
|
|
|
|
func watch(cmd *cobra.Command, args []string) {
|
|
cli.Watch(watchHost)
|
|
}
|