diff --git a/README.md b/README.md index 44cb46fd00492c0926c0440660e422aadf7246fa..e07fdc033ce751247ed39c1956373799b6387697 100644 --- a/README.md +++ b/README.md @@ -298,6 +298,7 @@ self-signed certificate authorities by making either of these changes: | `GLAB_CONFIG_DIR` | - | `~/.config/glab-cli/` | Directory where the `glab` global configuration file is located. Can be set in the config with `glab config set remote_alias origin`. | | `BROWSER` | `browser` | system default | The web browser to use for opening links. Can be set in the configuration with `glab config set browser mybrowser`. | | `FORCE_HYPERLINKS` | `display_hyperlinks` | `false` | Set to `1` to force hyperlinks to be output, even when not outputting to a TTY. | +| `GLAB_SEND_TELEMETRY` | `telemetry` | `true` | Set to `0` to prevent command usage data from being sent to your GitLab instance. | | `GLAMOUR_STYLE` | `glamour_style` | `dark` | Environment variable to set your desired Markdown renderer style. Available options are (`dark`, `light`, `notty`) or set a [custom style](https://github.com/charmbracelet/glamour#styles). | | `NO_COLOR` | - | `true` | Set to any value to avoid printing ANSI escape sequences for color output. | | `VISUAL`, `EDITOR` | `editor` | `nano` | (in order of precedence) The editor tool to use for authoring text. Can be set in the config with `glab config set editor vim`. | diff --git a/commands/root.go b/commands/root.go index f2396c8144752318d02179d178c21370ffb92ca4..f11d0b2f41ded3968087c133ecea8bc328129e7f 100644 --- a/commands/root.go +++ b/commands/root.go @@ -70,6 +70,10 @@ func NewCmdRoot(f *cmdutils.Factory, version, commit string) *cobra.Command { GLAB_CHECK_UPDATE: Set to 1 or true to force an update check. By default the cli tool checks for updates once a day. + GLAB_SEND_TELEMETRY: Set to 0 or false to disable telemetry being sent to your GitLab instance. + Can be set in the config with 'glab config set telemetry false'. + See https://docs.gitlab.com/administration/settings/usage_statistics/ for more information + GLAB_CONFIG_DIR: Set to a directory path to override the global configuration location. GLAMOUR_STYLE: The environment variable to set your desired Markdown renderer style. diff --git a/internal/config/config.yaml.lock b/internal/config/config.yaml.lock index f794679956a62858b78d94c5f9be0728ce41fa1a..fec79f59da89460074928cccdef770c1c60425d2 100644 --- a/internal/config/config.yaml.lock +++ b/internal/config/config.yaml.lock @@ -16,6 +16,10 @@ display_hyperlinks: false host: gitlab.com # Set to true (1) to disable prompts, or false (0) to enable them. no_prompt: false +# Set to false (0) to disable sending usage data to your GitLab instance or true (1) to enable. +# See https://docs.gitlab.com/administration/settings/usage_statistics/ +# for more information +telemetry: true # Configuration specific for GitLab instances. hosts: gitlab.com: diff --git a/internal/config/config_mapping.go b/internal/config/config_mapping.go index 98a0750a34307c4eca030d01a2e7c8fb1dfb2c64..ee26cc6ef631108ec56522c4a83e1202579135e3 100644 --- a/internal/config/config_mapping.go +++ b/internal/config/config_mapping.go @@ -17,6 +17,8 @@ func ConfigKeyEquivalence(key string) string { return "token" case "no_prompt", "prompt_disabled": return "no_prompt" + case "telemetry": + return "telemetry" case "git_remote_url_var", "git_remote_alias", "remote_alias", "remote_nickname", "git_remote_nickname": return "remote_alias" case "editor", "visual", "glab_editor": @@ -41,6 +43,8 @@ func EnvKeyEquivalence(key string) []string { return []string{"GITLAB_TOKEN", "GITLAB_ACCESS_TOKEN", "OAUTH_TOKEN"} case "no_prompt": return []string{"NO_PROMPT", "PROMPT_DISABLED"} + case "telemetry": + return []string{"GLAB_SEND_TELEMETRY"} case "editor", "visual", "glab_editor": return []string{"GLAB_EDITOR", "VISUAL", "EDITOR"} case "remote_alias": diff --git a/internal/config/config_stub.go b/internal/config/config_stub.go index a430df68efed683102caf87215a37636548902de..7f8d4847694c7ada0aad333e5e3e5e58af0fceac 100644 --- a/internal/config/config_stub.go +++ b/internal/config/config_stub.go @@ -95,6 +95,15 @@ func rootConfig() *yaml.Node { Kind: yaml.ScalarNode, Value: "false", }, + { + HeadComment: "# Set to false (0) to disable sending usage data to your GitLab instance or true (1) to enable.\n# See https://docs.gitlab.com/administration/settings/usage_statistics/\n# for more information", + Kind: yaml.ScalarNode, + Value: "telemetry", + }, + { + Kind: yaml.ScalarNode, + Value: "true", + }, { HeadComment: "# Configuration specific for GitLab instances.", Kind: yaml.ScalarNode,