This commit is contained in:
Andreas Penski 2022-11-18 07:21:56 +00:00
parent a10cc14d06
commit 219aeaa1b7
100 changed files with 27369 additions and 1072 deletions

View file

@ -84,7 +84,7 @@ public class CommandLineApplication {
resultStatus = ReturnValue.HELP_REQUEST;
} else {
resultStatus = ObjectUtils.defaultIfNull(commandLine.getExecutionResult(), ReturnValue.PARSING_ERROR);
if (resultStatus.getCode() < 0) {
if (resultStatus.isError()) {
commandLine.usage(System.out);
}
}

View file

@ -37,7 +37,7 @@ public class ReturnValue {
public static final ReturnValue DAEMON_MODE = new ReturnValue(-100);
public static final ReturnValue PARSING_ERROR = new ReturnValue(-1);;
public static final ReturnValue PARSING_ERROR = new ReturnValue(-1);
private final int code;
@ -45,4 +45,7 @@ public class ReturnValue {
return new ReturnValue(count);
}
public boolean isError() {
return this.code < 0 && this.code != DAEMON_MODE.code;
}
}

View file

@ -30,7 +30,7 @@ import lombok.RequiredArgsConstructor;
public class GuiHandler extends BaseHandler {
private static final URL INDEX_HTML = GuiHandler.class.getClassLoader().getResource("gui/index.html");
private static final URL INDEX_HTML = GuiHandler.class.getClassLoader().getResource("ui/index.html");
public GuiHandler() {
if (INDEX_HTML == null) {
@ -45,7 +45,7 @@ public class GuiHandler extends BaseHandler {
if (path.equals("/")) {
write(exchange, IOUtils.toString(INDEX_HTML, Charset.defaultCharset()).getBytes(), "text/html");
} else {
final URL resource = GuiHandler.class.getClassLoader().getResource("gui" + path);
final URL resource = GuiHandler.class.getClassLoader().getResource("ui" + path);
if (resource != null) {
write(exchange, IOUtils.toString(resource, Charset.defaultCharset()).getBytes(),
Mediatype.resolveBySuffix(resource.getPath()).getMimeType());
@ -59,7 +59,7 @@ public class GuiHandler extends BaseHandler {
@Getter
protected enum Mediatype {
JS("application/javascript"), MD("text/markdown"), CSS("text/css");
JS("application/javascript"), MD("text/markdown"), CSS("text/css"), SVG("image/svg+xml"), HTML("text/html"), PNG("image/png");
private final String mimeType;