diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/AffixLister.java | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/AffixLister.java b/src/AffixLister.java index ef7e3223..d20ca9b7 100644 --- a/src/AffixLister.java +++ b/src/AffixLister.java @@ -596,7 +596,7 @@ public class AffixLister { NAMED; } - private static int readNamesFromFile(Map<String, List<String>> fNames, String from, String defGroup) { + private static int readNamesFromFile(Map<String, List<String>> fNames, String from, String defGroup, boolean guessGroups) { int numFiles = 0; try (FileReader fr = new FileReader(from)) { Scanner scn = new Scanner(fr); @@ -616,6 +616,15 @@ public class AffixLister { } else { curList = fNames.get(curGroup); } + } else if (guessGroups && ln.contains("/mods/")) { + curGroup = ln.replaceAll(".*/mods/([^/]+)/*", "$1"); + + if (!fNames.containsKey(curGroup)) { + curList = new ArrayList<>(); + fNames.put(curGroup, curList); + } else { + curList = fNames.get(curGroup); + } } else { numFiles += 1; curList.add(ln); @@ -637,8 +646,9 @@ public class AffixLister { public static void main(String[] args) { boolean doingArgs = true; - boolean omitZeros = false; - boolean listZeros = false; + boolean omitZeros = false; + boolean listZeros = false; + boolean guessGroups = false; NameMode nameMode = NameMode.ALL; @@ -727,6 +737,12 @@ public class AffixLister { fGroups.put(curGroup, fNames); } break; + case "--guess-groups": + guessGroups = true; + break; + case "--no-guess-groups": + guessGroups = false; + break; case "--read-names-from-file": case "-r": if (i + 1 >= args.length) { @@ -734,7 +750,7 @@ public class AffixLister { break; } - fCount += readNamesFromFile(fGroups, args[++i], curGroup); + fCount += readNamesFromFile(fGroups, args[++i], curGroup, guessGroups); break; default: isArg = false; |
