All files / src/commands/features features.info.command.js

74.07% Statements 20/27
100% Branches 1/1
0% Functions 0/1
74.07% Lines 20/27

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x 193x               193x 193x  
import { z } from 'zod';
import { EXPERIMENTAL_FEATURES } from '../../config/features.js';
import { defineArgument } from '../../lib/define-argument.js';
import { defineCommand } from '../../lib/define-command.js';
import { Logger } from '../../logger.js';
 
export const featuresInfoCommand = defineCommand({
  description: 'Display info about an experimental feature',
  since: '3.11.0',
  options: {},
  args: [
    defineArgument({
      schema: z.string(),
      description: 'Experimental feature to manage',
      placeholder: 'feature',
    }),
  ],
  async handler(_options, feature) {
    const availableFeatures = Object.keys(EXPERIMENTAL_FEATURES);

    if (!availableFeatures.includes(feature)) {
      throw new Error(`Unavailable feature: ${feature}`);
    }

    Logger.println(EXPERIMENTAL_FEATURES[feature].instructions);
  },
});