2022-03-07 09:34:54 +00:00
|
|
|
package lombok.core;
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.PrintStream;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
2022-03-23 22:37:04 +00:00
|
|
|
/* loaded from: com.discord-120110.apk:lombok/core/Main.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
public class Main {
|
|
|
|
private static final Collection<?> HELP_SWITCHES = Collections.unmodifiableList(Arrays.asList("/?", "/h", "/help", "-h", "-help", "--help", "help", "h"));
|
|
|
|
private final List<LombokApp> apps;
|
|
|
|
private final List<String> args;
|
|
|
|
|
2022-03-23 22:37:04 +00:00
|
|
|
/* loaded from: com.discord-120110.apk:lombok/core/Main$LicenseApp.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
public static class LicenseApp extends LombokApp {
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public String getAppName() {
|
|
|
|
return "license";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public String getAppDescription() {
|
|
|
|
return "prints license information.";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public List<String> getAppAliases() {
|
|
|
|
return Arrays.asList("licence", "copyright", "copyleft", "gpl");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public int runApp(List<String> list) {
|
|
|
|
try {
|
|
|
|
InputStream resourceAsStream = Main.class.getResourceAsStream("/LICENSE");
|
|
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
|
|
byte[] bArr = new byte[65536];
|
|
|
|
while (true) {
|
|
|
|
int read = resourceAsStream.read(bArr);
|
|
|
|
if (read == -1) {
|
|
|
|
System.out.println(new String(byteArrayOutputStream.toByteArray()));
|
|
|
|
resourceAsStream.close();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
byteArrayOutputStream.write(bArr, 0, read);
|
|
|
|
}
|
|
|
|
} catch (Exception unused) {
|
|
|
|
System.err.println("License file not found. Check https://projectlombok.org/LICENSE");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 22:37:04 +00:00
|
|
|
/* loaded from: com.discord-120110.apk:lombok/core/Main$VersionApp.SCL.lombok */
|
2022-03-07 09:34:54 +00:00
|
|
|
public static class VersionApp extends LombokApp {
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public String getAppName() {
|
|
|
|
return "version";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public String getAppDescription() {
|
|
|
|
return "prints lombok's version.";
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public List<String> getAppAliases() {
|
|
|
|
return Arrays.asList("-version", "--version");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // lombok.core.LombokApp
|
|
|
|
public int runApp(List<String> list) {
|
|
|
|
System.out.println(Version.getFullVersion());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void main(String[] strArr) throws IOException {
|
|
|
|
Thread.currentThread().setContextClassLoader(Main.class.getClassLoader());
|
|
|
|
int go = new Main(SpiLoadUtil.readAllFromIterator(SpiLoadUtil.findServices(LombokApp.class)), Arrays.asList(strArr)).go();
|
|
|
|
if (go != 0) {
|
|
|
|
System.exit(go);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public Main(List<LombokApp> list, List<String> list2) {
|
|
|
|
this.apps = list;
|
|
|
|
this.args = list2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:23:0x00a5 */
|
|
|
|
/*
|
|
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
|
|
*/
|
|
|
|
public int go() {
|
|
|
|
if (this.args.isEmpty() || !HELP_SWITCHES.contains(this.args.get(0))) {
|
|
|
|
String trim = this.args.isEmpty() ? "" : this.args.get(0).trim();
|
|
|
|
if (trim.startsWith("--")) {
|
|
|
|
trim = trim.substring(2);
|
|
|
|
} else if (trim.startsWith("-")) {
|
|
|
|
trim = trim.substring(1);
|
|
|
|
}
|
|
|
|
List<String> emptyList = this.args.isEmpty() ? Collections.emptyList() : Collections.unmodifiableList(this.args.subList(1, this.args.size()));
|
|
|
|
Iterator<LombokApp> it = this.apps.iterator();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
LombokApp next = it.next();
|
|
|
|
if (next.getAppName().equals(trim) || next.getAppAliases().contains(trim)) {
|
|
|
|
try {
|
|
|
|
return next.runApp(emptyList);
|
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
return 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (it.hasNext()) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printHelp("Unknown command: " + trim, System.err);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
printHelp(null, System.out);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void printHelp(String str, PrintStream printStream) {
|
|
|
|
if (str != null) {
|
|
|
|
printStream.println(str);
|
|
|
|
printStream.println("------------------------------");
|
|
|
|
}
|
|
|
|
printStream.println("projectlombok.org " + Version.getFullVersion());
|
|
|
|
printStream.println("Copyright (C) 2009-2018 The Project Lombok Authors.");
|
|
|
|
printStream.println("Run 'lombok license' to see the lombok license agreement.");
|
|
|
|
printStream.println();
|
|
|
|
printStream.println("Run lombok without any parameters to start the graphical installer.");
|
|
|
|
printStream.println("Other available commands:");
|
|
|
|
Iterator<LombokApp> it = this.apps.iterator();
|
|
|
|
while (it.hasNext()) {
|
|
|
|
LombokApp next = it.next();
|
|
|
|
if (!next.isDebugTool()) {
|
|
|
|
String[] split = next.getAppDescription().split("\n");
|
|
|
|
int i = 0;
|
|
|
|
while (i < split.length) {
|
|
|
|
Object[] objArr = new Object[2];
|
|
|
|
objArr[0] = i == 0 ? next.getAppName() : "";
|
|
|
|
objArr[1] = split[i];
|
|
|
|
printStream.printf(" %15s %s\n", objArr);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
printStream.println();
|
|
|
|
printStream.println("Run lombok commandName --help for more info on each command.");
|
|
|
|
}
|
|
|
|
}
|