Index: pkg/analyzer_cli/lib/src/options.dart |
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart |
index fdf70f550b99e4684194f437e071a629fc9c5256..cf9e6f2a4dee5fca6f522af0cb33b10148882986 100644 |
--- a/pkg/analyzer_cli/lib/src/options.dart |
+++ b/pkg/analyzer_cli/lib/src/options.dart |
@@ -349,8 +349,6 @@ class CommandLineOptions { |
help: 'Treat non-type warnings as fatal.', |
defaultsTo: false, |
negatable: false) |
- ..addFlag('analytics', |
- help: 'Enable or disable sending analytics information to Google.') |
..addFlag('help', |
abbr: 'h', |
help: |
@@ -363,6 +361,11 @@ class CommandLineOptions { |
help: 'Verbose output.', |
negatable: false); |
+ if (telemetry.SHOW_ANALYTICS_UI) { |
+ parser.addFlag('analytics', |
+ help: 'Enable or disable sending analytics information to Google.'); |
+ } |
+ |
// Build mode options. |
if (!hide) { |
parser.addSeparator('Build mode flags:'); |
@@ -534,12 +537,14 @@ class CommandLineOptions { |
} |
// Enable / disable analytics. |
- if (results.wasParsed('analytics')) { |
- analytics.enabled = results['analytics']; |
- outSink |
- .writeln(telemetry.createAnalyticsStatusMessage(analytics.enabled)); |
- exitHandler(0); |
- return null; // Only reachable in testing. |
+ if (telemetry.SHOW_ANALYTICS_UI) { |
+ if (results.wasParsed('analytics')) { |
+ analytics.enabled = results['analytics']; |
+ outSink.writeln( |
+ telemetry.createAnalyticsStatusMessage(analytics.enabled)); |
+ exitHandler(0); |
+ return null; // Only reachable in testing. |
+ } |
} |
// Batch mode and input files. |
@@ -581,6 +586,10 @@ class CommandLineOptions { |
static _showUsage(ArgParser parser, telemetry.Analytics analytics, |
{bool fromHelp: false}) { |
void printAnalyticsInfo() { |
+ if (!telemetry.SHOW_ANALYTICS_UI) { |
+ return; |
+ } |
+ |
if (fromHelp) { |
errorSink.writeln(''); |
errorSink.writeln(telemetry.analyticsNotice); |