execute method

  1. @override
Future<int> execute(
  1. List<String> arguments
)
override

Executes the command with the provided arguments. Returns an integer exit code (0 for success).

Implementation

@override
Future<int> execute(List<String> arguments) async {
  final templates = _repository.getAvailableTemplates();

  if (templates.isEmpty) {
    _output.info('No templates found.');
    return 0;
  }

  _output.info('Available templates:\n');

  for (final template in templates) {
    _output.info('  ${template.name}');
    _output.info('    ${template.description}\n');
  }

  final firstTemplate = templates.first.name;
  _output.info('Use:');
  _output.info('  flutter_setup create my_app --template $firstTemplate');

  return 0;
}