-
Notifications
You must be signed in to change notification settings - Fork 203
Expand file tree
/
Copy pathanalytics.ts
More file actions
24 lines (21 loc) · 884 Bytes
/
analytics.ts
File metadata and controls
24 lines (21 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { getAnalyticsEnabledAsync, setAnalyticsEnabledAsync } from '../analytics/AnalyticsManager';
import EasCommand from '../commandUtils/EasCommand';
import Log from '../log';
export default class AnalyticsView extends EasCommand {
static override description = 'display or change analytics settings';
static override args = [{ name: 'STATUS', options: ['on', 'off'] }];
async runAsync(): Promise<void> {
const { STATUS: status } = (await this.parse(AnalyticsView)).args;
if (status) {
await setAnalyticsEnabledAsync(status === 'on');
Log.withTick(`${status === 'on' ? 'Enabling' : 'Disabling'} analytics.`);
} else {
const analyticsEnabled = await getAnalyticsEnabledAsync();
Log.log(
`Analytics are ${
analyticsEnabled === false ? 'disabled' : 'enabled'
} on this eas-cli installation.`
);
}
}
}