in dartfn/lib/src/cli/command/generate.dart [50:82]
Future<void> run() async {
final generators = context.generator.generators;
final options = argResults!;
if (options['machine'] as bool) {
return write(_createMachineInfo(generators));
}
if (options['list'] as bool) {
return _listGenerators(generators);
}
if (options.rest.isEmpty) {
error('No generator specified.');
write();
return _listGenerators(generators);
}
if (options.rest.length >= 2) {
usageException('Too many arguments (should only be one generator).');
}
final generatorName = options.rest.first;
if (!(options['force'] as bool) && !await context.generator.cwd.isEmpty()) {
return error(
'The current directory is not empty. Overwritting an exising project '
'is NOT recommended.\n'
'Create a new (empty) project directory, or use --force to override '
"this safeguard if you know what you're doing.");
}
return await _generate(generatorName);
}