Skip to content

Commit

Permalink
feat: add core flags in config/analyticscommand
Browse files Browse the repository at this point in the history
  • Loading branch information
Amzani committed Jun 4, 2024
1 parent bbb8ee1 commit 40d7d9f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/commands/config/analytics.ts
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
11 changes: 11 additions & 0 deletions src/core/flags/config/analytics.flags.ts
Original file line number Diff line number Diff line change
@@ -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' }),
};
};

0 comments on commit 40d7d9f

Please sign in to comment.