run method

  1. @override
Future<void> run()
override

Runs this command.

The return value is wrapped in a Future if necessary and returned by CommandRunner.runCommand.

Implementation

@override
Future<void> run() async {
  // Check if the user provided a component name
  if (argResults == null || argResults!.rest.isEmpty) {
    print('Error: Component name is required.');
    print(usage);
    return;
  }

  // Get the component name from the command arguments
  final componentName = argResults!.rest[0];
  print('Generating component: $componentName...');

  // Generate the requested component
  createComponent(componentName);
}