Skip to content

Commit 2ba27c0

Browse files
add DecompileCommand::run override accepting enum
1 parent 0795c31 commit 2ba27c0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

enigma-cli/src/main/java/org/quiltmc/enigma/command/DecompileCommand.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public String getDescription() {
5252
return "Decompiles the provided jar into human-readable code.";
5353
}
5454

55+
public static void run(Decompiler decompiler, Path fileJarIn, Path fileJarOut, Path fileMappings) throws Exception {
56+
run(decompiler.toString(), fileJarIn, fileJarOut, fileMappings);
57+
}
58+
5559
public static void run(String decompilerName, Path fileJarIn, Path fileJarOut, Path fileMappings) throws Exception {
5660
DecompilerService decompilerService;
5761

enigma-cli/src/test/java/org/quiltmc/enigma/command/ValidateArgNamesTest.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,8 @@ private static Set<String> validateArgs(String cmdName, ImmutableList<Argument<?
3333
for (int i = 0; i < argName.length(); i++) {
3434
final char c = argName.charAt(i);
3535

36-
Assertions.assertNotEquals(
37-
Argument.SEPARATOR, c,
38-
() -> getIllegalCharacterMessage(cmdName, argName, Argument.SEPARATOR)
39-
);
40-
41-
Assertions.assertNotEquals(
42-
Argument.NAME_DELIM, c,
43-
() -> getIllegalCharacterMessage(cmdName, argName, Argument.NAME_DELIM)
44-
);
36+
assertLegal(cmdName, argName, Argument.SEPARATOR, c);
37+
assertLegal(cmdName, argName, Argument.NAME_DELIM, c);
4538
}
4639

4740
Assertions.assertTrue(
@@ -53,8 +46,11 @@ private static Set<String> validateArgs(String cmdName, ImmutableList<Argument<?
5346
return argNames;
5447
}
5548

56-
private static String getIllegalCharacterMessage(String cmdName, String argName, char illegal) {
57-
return "Command '%s' arg '%s' name must not contain '%s'".formatted(cmdName, argName, illegal);
49+
private static void assertLegal(String cmdName, String argName, char illegal, char actual) {
50+
Assertions.assertNotEquals(
51+
illegal, actual,
52+
() -> "Command '%s' arg '%s' name must not contain '%s'".formatted(cmdName, argName, illegal)
53+
);
5854
}
5955

6056
private static String getDuplicateNameMessage(String cmdName, String argName) {

0 commit comments

Comments
 (0)