CAKE-272 | refactored script

This commit is contained in:
OleksandrSobol 2021-03-24 19:55:45 +02:00
parent ff8ed30483
commit b009b2a6e4

View file

@ -28,11 +28,19 @@ Future<void> main(List<String> args) async {
: <String, dynamic> {srcDir : inputPath};
extraInfo.forEach((key, dynamic value) async {
if (key == srcDir) {
if (key != srcDir) {
print('Wrong key: $key');
return;
}
final dirPath = value as String;
final dir = Directory(dirPath);
if (await dir.exists()) {
if (!await dir.exists()) {
print('Wrong directory path: $dirPath');
return;
}
final localePath = <String, dynamic>{};
await dir.list(recursive: false).forEach((element) {
try {
@ -43,7 +51,11 @@ Future<void> main(List<String> args) async {
}
});
if (localePath.keys.contains(defaultLocale)) {
if (!localePath.keys.contains(defaultLocale)) {
print("Locale list doesn't contain $defaultLocale");
return;
}
try {
var output = '';
var locales = 'const locales = [';
@ -99,15 +111,6 @@ Future<void> main(List<String> args) async {
} catch (e) {
print(e.toString());
}
} else {
print("Locale list doesn't contain $defaultLocale");
}
} else {
print('Wrong directory path: $dirPath');
}
} else {
print('Wrong key: $key');
}
});
}