run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
FutureOr run() async {
final files = _files();
if (files.isNotEmpty) {
final arbPartImport = ArbPartImport();
for (final file in files) {
try {
final content = file.readAsStringSync();
arbPartImport.add(jsonDecode(content));
logger.info('Import from ${file.path}');
} on ArbImportException catch (e) {
logger.severe('${e.message} in ${file.path}');
} catch (e) {
rethrow;
}
}
final importedLocales = arbPartImport.locales;
if (importedLocales.isNotEmpty) {
final locale = importedLocales.length <= 1
? importedLocales.first
: _locale(importedLocales);
_saveParts(arbPartImport.split(locale));
}
}
}