Skip to content

Commit

Permalink
Add --status flag
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-rr committed Apr 23, 2024
1 parent 7108478 commit 5865e96
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/commands/config/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default class Analytics extends Command {
help: Flags.help({ char: 'h' }),
disable: Flags.boolean({ char: 'd', description: 'disable analytics', default: false }),
enable: Flags.boolean({ char: 'e', description: 'enable analytics', default: false }),
status: Flags.boolean({ char: 's', description: 'show analytics current status' }),

};

async run() {
Expand All @@ -27,11 +29,15 @@ export default class Analytics extends Command {
} else if (flags.enable) {
analyticsConfigFileContent.analyticsEnabled = 'true';
this.log('Analytics enabled.');
} else {
} else if (!flags.status) {
this.log('\nPlease append the "--disable" flag to the command in case you prefer to disable analytics, or use the "--enable" flag if you want to enable analytics back again.\n');
return;
}
await writeFile(analyticsConfigFile, JSON.stringify(analyticsConfigFileContent), { encoding: 'utf8' });

if (flags.status) {
this.log(analyticsConfigFileContent.analyticsEnabled);
}
} catch (e: any) {
switch (e.code) {
case 'ENOENT':
Expand Down

0 comments on commit 5865e96

Please sign in to comment.