(version string)
| 30 | type Ctl struct{} |
| 31 | |
| 32 | func Execute(version string) { |
| 33 | root := &cobra.Command{ |
| 34 | Use: "deepflow-ctl", |
| 35 | Short: "deepflow server tool", |
| 36 | TraverseChildren: true, |
| 37 | } |
| 38 | |
| 39 | var outputVersion bool |
| 40 | root.PersistentFlags().BoolVarP(&outputVersion, "version", "v", false, "deepflow-ctl version") |
| 41 | root.PersistentFlags().StringP("ip", "i", common.GetDefaultRouteIP(), "deepflow-server service ip") |
| 42 | root.PersistentFlags().Uint32P("api-port", "", 30417, "deepflow-server service node port") |
| 43 | root.PersistentFlags().Uint32P("rpc-port", "", 30035, "deepflow-server service grpc port") |
| 44 | root.PersistentFlags().Uint32P("svc-port", "", 20417, "deepflow-server service http port") |
| 45 | root.PersistentFlags().Uint32P("org-id", "", common.DEFAULT_ORG_ID, "organization id") |
| 46 | root.PersistentFlags().DurationP("timeout", "", time.Second*30, "deepflow-ctl timeout") |
| 47 | root.ParseFlags(os.Args[1:]) |
| 48 | |
| 49 | // support output version |
| 50 | if outputVersion { |
| 51 | fmt.Printf(version) |
| 52 | return |
| 53 | } |
| 54 | |
| 55 | root.AddCommand(RegisterAgentCommand()) |
| 56 | root.AddCommand(RegisterAgentUpgradeCommand()) |
| 57 | root.AddCommand(RegisterAgentGroupCommand()) |
| 58 | root.AddCommand(RegisterAgentGroupConfigCommand()) |
| 59 | root.AddCommand(RegisterDomainCommand()) |
| 60 | root.AddCommand(RegisterSubDomainCommand()) |
| 61 | root.AddCommand(RegisterGenesisCommand()) |
| 62 | root.AddCommand(RegisterCloudCommand()) |
| 63 | root.AddCommand(RegisterRecorderCommand()) |
| 64 | root.AddCommand(RegisterTrisolarisCommand()) |
| 65 | root.AddCommand(RegisterVPCCommend()) |
| 66 | root.AddCommand(RegisterServerCommand()) |
| 67 | root.AddCommand(RegisterRepoCommand()) |
| 68 | root.AddCommand(RegisterPluginCommand()) |
| 69 | root.AddCommand(RegisterPrometheusCommand()) |
| 70 | root.AddCommand(RegisterPromQLCommand()) |
| 71 | root.AddCommand(AgentCheckRegisterCommand()) |
| 72 | |
| 73 | cmd.RegisterIngesterCommand(root) |
| 74 | |
| 75 | root.SetArgs(os.Args[1:]) |
| 76 | root.Execute() |
| 77 | } |
nothing calls this directly
no test coverage detected