From 5865e96aa2150be6260b6d57384f2c89d05cf784 Mon Sep 17 00:00:00 2001 From: Pedro Ramos Date: Tue, 23 Apr 2024 18:16:53 +0200 Subject: [PATCH] Add --status flag --- src/commands/config/analytics.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/commands/config/analytics.ts b/src/commands/config/analytics.ts index e9c1fdaf224..4d5806235a7 100644 --- a/src/commands/config/analytics.ts +++ b/src/commands/config/analytics.ts @@ -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() { @@ -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':