From e9e0da32e8cc2ed023bd48d211deb93f0da045f3 Mon Sep 17 00:00:00 2001 From: Olivier CANO Date: Tue, 11 Feb 2020 10:36:52 +0100 Subject: [PATCH] fix(telemetry): disable telemetry on completion --- internal/core/build_info_test.go | 5 ++- .../namespaces/autocomplete/autocomplete.go | 32 +++++++++++-------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/internal/core/build_info_test.go b/internal/core/build_info_test.go index 0f27fb813c..67e68309ad 100644 --- a/internal/core/build_info_test.go +++ b/internal/core/build_info_test.go @@ -12,9 +12,8 @@ import ( ) var fakeCommand = &Command{ - Namespace: "plop", - DisableTelemetry: true, - ArgsType: reflect.TypeOf(args.RawArgs{}), + Namespace: "plop", + ArgsType: reflect.TypeOf(args.RawArgs{}), Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) { return &SuccessResult{}, nil }, diff --git a/internal/namespaces/autocomplete/autocomplete.go b/internal/namespaces/autocomplete/autocomplete.go index a9ba4ffffb..ea6317ee11 100644 --- a/internal/namespaces/autocomplete/autocomplete.go +++ b/internal/namespaces/autocomplete/autocomplete.go @@ -236,9 +236,10 @@ func autocompleteCompleteBashCommand() *core.Command { Resource: "complete", Verb: "bash", // TODO: Switch NoClient to true when cache will be implemented. - NoClient: false, - Hidden: true, - ArgsType: reflect.TypeOf(args.RawArgs{}), + NoClient: false, + Hidden: true, + DisableTelemetry: true, + ArgsType: reflect.TypeOf(args.RawArgs{}), Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) { rawArgs := *argsI.(*args.RawArgs) wordIndex, err := strconv.Atoi(rawArgs[1]) @@ -273,9 +274,10 @@ func autocompleteCompleteFishCommand() *core.Command { Resource: "complete", Verb: "fish", // TODO: Switch NoClient to true when cache will be implemented. - NoClient: false, - Hidden: true, - ArgsType: reflect.TypeOf(args.RawArgs{}), + NoClient: false, + Hidden: true, + DisableTelemetry: true, + ArgsType: reflect.TypeOf(args.RawArgs{}), Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) { rawArgs := *argsI.(*args.RawArgs) leftWords := rawArgs[3:] @@ -304,9 +306,10 @@ func autocompleteCompleteZshCommand() *core.Command { Resource: "complete", Verb: "zsh", // TODO: Switch NoClient to true when cache will be implemented. - NoClient: false, - Hidden: true, - ArgsType: reflect.TypeOf(args.RawArgs{}), + NoClient: false, + Hidden: true, + DisableTelemetry: true, + ArgsType: reflect.TypeOf(args.RawArgs{}), Run: func(ctx context.Context, argsI interface{}) (i interface{}, e error) { rawArgs := *argsI.(*args.RawArgs) @@ -343,11 +346,12 @@ type autocompleteShowArgs struct { func autocompleteScriptCommand() *core.Command { return &core.Command{ - Short: `Show autocomplete script for current shell`, - Long: `Show autocomplete script for current shell.`, - Namespace: "autocomplete", - Resource: "script", - NoClient: true, + Short: `Show autocomplete script for current shell`, + Long: `Show autocomplete script for current shell.`, + Namespace: "autocomplete", + Resource: "script", + NoClient: true, + DisableTelemetry: true, ArgSpecs: core.ArgSpecs{ { Name: "shell",