run method

void run(
  1. List<String> args
)

Implementation

void run(List<String> args) {
  if (!validateArgs(args)) return;

  final featureName = args[0];
  final projectPath = Directory.current.path;

  if (!Validator.isFlutterProject(projectPath)) {
    print('\n❌ Current directory is not a Flutter project!');
    print('Please navigate to your Flutter project directory first.');
    return;
  }

  final featurePath = p.join(projectPath, 'lib', 'features', featureName);

  if (Directory(featurePath).existsSync()) {
    print('\n❌ Feature "$featureName" already exists!');
    return;
  }

  _generateFeature(featureName, featurePath, projectPath);
  _updateRoutes(projectPath, featureName);
  _updateDI(projectPath, featureName);
  _showSuccessMessage(featureName);
}