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; public class GuiCommand extends Command { public GuiCommand() { super("Displays the Inceptum UI", "gui", "show"); } @Override public void invoke(CommandArguments args) { 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)); } } @Override public boolean enableLog() { return true; } }