-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
/
Copy pathanalytics.rb
48 lines (42 loc) · 1.35 KB
/
analytics.rb
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
43
44
45
46
47
48
# typed: strict
# frozen_string_literal: true
require "abstract_command"
module Homebrew
module Cmd
class Analytics < AbstractCommand
cmd_args do
description <<~EOS
Control Homebrew's anonymous aggregate user behaviour analytics.
Read more at <https://docs.brew.sh/Analytics>.
`brew analytics` [`state`]:
Display the current state of Homebrew's analytics.
`brew analytics` (`on`|`off`):
Turn Homebrew's analytics on or off respectively.
EOS
named_args %w[state on off regenerate-uuid], max: 1
end
sig { override.void }
def run
case args.named.first
when nil, "state"
if Utils::Analytics.disabled?
puts "InfluxDB analytics are disabled."
else
puts "InfluxDB analytics are enabled."
end
puts "Google Analytics were destroyed."
when "on"
Utils::Analytics.enable!
when "off"
Utils::Analytics.disable!
when "regenerate-uuid"
Utils::Analytics.delete_uuid!
opoo "Homebrew no longer uses an analytics UUID so this has been deleted!"
puts "brew analytics regenerate-uuid is no longer necessary."
else
raise UsageError, "unknown subcommand: #{args.named.first}"
end
end
end
end
end