Inceptum/src/main/java/io/gitlab/jfronny/inceptum/cli/GuiCommand.java

39 lines
1.2 KiB
Java
Raw Normal View History

2021-10-30 22:05:24 +02:00
package io.gitlab.jfronny.inceptum.cli;
import io.gitlab.jfronny.inceptum.Inceptum;
import io.gitlab.jfronny.inceptum.InceptumGui;
import io.gitlab.jfronny.inceptum.model.inceptum.CommandArguments;
import io.gitlab.jfronny.inceptum.model.inceptum.UpdateInfo;
import java.io.IOException;
import java.net.URISyntaxException;
2021-10-30 22:05:24 +02:00
public class GuiCommand extends Command {
public GuiCommand() {
super("Displays the Inceptum UI", "gui", "show");
}
@Override
public void invoke(CommandArguments args) {
2021-10-30 22:05:24 +02:00
Inceptum.IS_GUI = true;
UpdateInfo update = UpdateCheckCommand.getUpdate();
if (update == null) {
InceptumGui.main(args);
} else {
Inceptum.showOkCancel("An update was found. Should it be installed automatically?", "Update found", () -> {
try {
UpdateCheckCommand.update(update, true);
InceptumGui.exit();
} catch (IOException | URISyntaxException e) {
Inceptum.showError("Could not download update", e);
}
}, () -> InceptumGui.main(args));
}
2021-10-30 22:05:24 +02:00
}
@Override
public boolean enableLog() {
return true;
}
}