execute static method

Future<void> execute(
  1. String projectPath,
  2. String featureName
)

Implementation

static Future<void> execute(String projectPath, String featureName) async {
  final baseDir = projectPath.endsWith('/')
      ? projectPath.substring(0, projectPath.length - 1)
      : projectPath;

  final featureDir = Directory('$baseDir/lib/features/$featureName');
  if (await featureDir.exists()) {
    print('Feature already exists.');
    print('Choose another name.');
    return;
  }

  print('Generating feature...');
  final generator = FeatureGenerator();
  await generator.generateFeature(projectPath, featureName);
  print('Feature created successfully.');
}