Commit 6f073c97 authored by 王品堯's avatar 王品堯

增加參數的判斷

parent 1db7e5c2
......@@ -19,12 +19,15 @@ public class LanguageFileCompare {
public static void main(String[] args) {
try {
ObjectMapper objectMapper = new ObjectMapper();
Path originPath = Paths.get(args[0]);
JsonNode twJson = objectMapper.readTree(new String(Files.readAllBytes(originPath)));
Set<String> originSet = new HashSet<>();
addKeys("", twJson, originSet, new ArrayList<>());
if (args.length > 0) {
Path originPath = Paths.get(args[0]);
JsonNode twJson = objectMapper.readTree(new String(Files.readAllBytes(originPath)));
Set<String> originSet = new HashSet<>();
addKeys("", twJson, originSet, new ArrayList<>());
IntStream.range(1, args.length).forEach(i -> findMissingKeys(Paths.get(args[i]), originSet));
IntStream.range(1, args.length)
.forEach(i -> findMissingKeys(Paths.get(args[i]), originSet));
}
} catch (Exception e) {
log.error("{} is not exists or not json files.", args[0], e);
System.exit(1);
......@@ -87,9 +90,9 @@ public class LanguageFileCompare {
Map<String, List<String>> map =
Arrays.stream(
Optional.ofNullable(
Paths.get(path).toFile().list((dir, name) -> name.endsWith(extension)))
.orElse(new String[0]))
Optional.ofNullable(
Paths.get(path).toFile().list((dir, name) -> name.endsWith(extension)))
.orElse(new String[0]))
.map(s -> s.split(extension)[0])
.collect(
Collectors.groupingBy(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment