diff --git a/src/commands/config/analytics.ts b/src/commands/config/analytics.ts index 8cedc97c565..5541a494c41 100644 --- a/src/commands/config/analytics.ts +++ b/src/commands/config/analytics.ts @@ -1,19 +1,14 @@ -import { Flags } from '@oclif/core'; import { join, resolve } from 'path'; import Command from '../../core/base'; import { promises as fPromises } from 'fs'; import { homedir } from 'os'; +import { analyticsFlags } from '../../core/flags/config/analytics.flags'; const { readFile, writeFile } = fPromises; export default class Analytics extends Command { static readonly description = 'Enable or disable analytics for metrics collection'; - static readonly flags = { - 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 current status of analytics' }), - }; + static readonly flags = analyticsFlags(); async run() { const { flags } = await this.parse(Analytics); diff --git a/src/core/flags/config/analytics.flags.ts b/src/core/flags/config/analytics.flags.ts new file mode 100644 index 00000000000..b2bac4a2c82 --- /dev/null +++ b/src/core/flags/config/analytics.flags.ts @@ -0,0 +1,11 @@ +import { Flags } from '@oclif/core'; + +export const analyticsFlags = () => { + return { + 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 current status of analytics' }), + }; +}; +