run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
void run() async {
try {
final argMorphemeYaml = argResults.getOptionMorphemeYaml();
YamlHelper.validateMorphemeYaml(argMorphemeYaml);
final morphemeConfig = YamlHelper.loadFileYaml(argMorphemeYaml);
final downloadConfig = _validateDownloadConfiguration(morphemeConfig);
if (downloadConfig.isEmpty) {
printMessage('📎 No download configurations found in morpheme.yaml');
StatusHelper.success('No downloads to process');
return;
}
printMessage(
'📦 Starting download process for ${downloadConfig.length} item(s)...');
// Process downloads concurrently for better performance
final downloadTasks = downloadConfig.entries
.map((entry) => _processDownloadItem(entry.key, entry.value))
.toList();
await Future.wait(downloadTasks);
printMessage('✨ All downloads completed successfully!');
StatusHelper.success('download operation completed');
} catch (e) {
StatusHelper.failed('Download operation failed: $e');
}
}