root.go 523 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. Copyright © 2022 NAME HERE <EMAIL ADDRESS>
  3. */
  4. package cmd
  5. import (
  6. "os"
  7. "github.com/spf13/cobra"
  8. )
  9. var RootCmd = &cobra.Command{
  10. Use: "kpt-grpc-demo",
  11. Short: "自定义事件驱动系统",
  12. }
  13. // Execute adds all child commands to the root command and sets flags appropriately.
  14. // This is called by main.main(). It only needs to happen once to the rootCmd.
  15. func Execute() {
  16. err := RootCmd.Execute()
  17. if err != nil {
  18. os.Exit(1)
  19. }
  20. }
  21. func init() {
  22. RootCmd.AddCommand(httpCmd)
  23. RootCmd.AddCommand(grpcCmd)
  24. }