MCPcopy
hub / github.com/ionic-team/capacitor / telemetryCommand

Function telemetryCommand

cli/src/tasks/telemetry.ts:10–30  ·  view source on GitHub ↗
(onOrOff?: string)

Source from the content-addressed store, hash-verified

8 `\nInformation about the data we collect is available on our website: ${c.strong('https://capacitorjs.com/docs/next/cli/telemetry')}\n`;
9
10export async function telemetryCommand(onOrOff?: string): Promise<void> {
11 const sysconfig = await readConfig();
12 const enabled = interpretEnabled(onOrOff);
13
14 if (typeof enabled === 'boolean') {
15 if (sysconfig.telemetry === enabled) {
16 logger.info(`Telemetry is already ${c.strong(enabled ? 'on' : 'off')}`);
17 } else {
18 await writeConfig({ ...sysconfig, telemetry: enabled });
19 logSuccess(
20 `You have ${c.strong(`opted ${enabled ? 'in' : 'out'}`)} ${enabled ? 'for' : 'of'} telemetry on this machine.`,
21 );
22
23 if (enabled) {
24 output.write(THANK_YOU);
25 }
26 }
27 } else {
28 logger.info(`Telemetry is ${c.strong(sysconfig.telemetry ? 'on' : 'off')}`);
29 }
30}
31
32function interpretEnabled(onOrOff?: string): boolean | undefined {
33 switch (onOrOff) {

Callers 1

runProgramFunction · 0.85

Calls 5

readConfigFunction · 0.90
writeConfigFunction · 0.90
logSuccessFunction · 0.90
interpretEnabledFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected