-
Notifications
You must be signed in to change notification settings - Fork 130
/
status.go
42 lines (34 loc) · 1.03 KB
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package telemetry
import (
"github.com/spf13/cobra"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/commands/common"
"github.com/kubeshop/testkube/cmd/kubectl-testkube/config"
"github.com/kubeshop/testkube/pkg/ui"
)
func NewStatusTelemetryCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "telemetry",
Short: "Get telemetry status",
Run: func(cmd *cobra.Command, args []string) {
ui.NL()
ui.Print(ui.IconRocket + " Getting telemetry status on the testkube CLI and API")
cfg, err := config.Load()
ui.ExitOnError(" Loading config file failed", err)
if cfg.TelemetryEnabled {
ui.PrintEnabled("Telemetry on CLI", "enabled")
} else {
ui.PrintDisabled("Telemetry on CLI", "disabled")
}
client, _ := common.GetClient(cmd)
config, err := client.GetConfig()
ui.ExitOnError(" Getting API config failed", err)
if config.EnableTelemetry {
ui.PrintEnabled("Telemetry on API", "enabled")
} else {
ui.PrintDisabled("Telemetry on API", "disabled")
}
ui.NL()
},
}
return cmd
}