Add some command line params

This commit is contained in:
comp500 2019-06-08 02:05:43 +01:00
parent 3d28f0a674
commit e65d20be79
No known key found for this signature in database
GPG Key ID: 214C822FFEC586B5
2 changed files with 20 additions and 19 deletions

View File

@ -94,6 +94,16 @@ public class Main {
uOptions.side = UpdateManager.Options.Side.from(side); uOptions.side = UpdateManager.Options.Side.from(side);
} }
String packFolder = cmd.getOptionValue("pack-folder");
if (packFolder != null) {
uOptions.packFolder = packFolder;
}
String metaFile = cmd.getOptionValue("meta-file");
if (metaFile != null) {
uOptions.manifestFile = metaFile;
}
try { try {
uOptions.downloadURI = new URI(unparsedArgs[0]); uOptions.downloadURI = new URI(unparsedArgs[0]);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
@ -122,6 +132,8 @@ public class Main {
public static void addNonBootstrapOptions(Options options) { public static void addNonBootstrapOptions(Options options) {
options.addOption("s", "side", true, "Side to install mods from (client/server, defaults to client)"); options.addOption("s", "side", true, "Side to install mods from (client/server, defaults to client)");
options.addOption(null, "title", true, "Title of the installer window"); options.addOption(null, "title", true, "Title of the installer window");
options.addOption(null, "pack-folder", true, "Folder to install the pack to (defaults to the JAR directory)");
options.addOption(null, "meta-file", true, "JSON file to store pack metadata, relative to the pack folder (defaults to packwiz.json)");
} }
// TODO: link these somehow so they're only defined once? // TODO: link these somehow so they're only defined once?

View File

@ -8,8 +8,9 @@ public class UpdateManager {
public final IUserInterface ui; public final IUserInterface ui;
public static class Options { public static class Options {
public URI downloadURI; public URI downloadURI = null;
public String manifestFile = "packwiz.json"; public String manifestFile = "packwiz.json"; // TODO: make configurable
public String packFolder = ".";
public Side side = Side.CLIENT; public Side side = Side.CLIENT;
public static enum Side { public static enum Side {
@ -66,23 +67,11 @@ public class UpdateManager {
} }
protected void start() { protected void start() {
this.checkOptions();
ui.submitProgress(new InstallProgress("Loading pack file...")); ui.submitProgress(new InstallProgress("Loading pack file..."));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Big oof
}
ui.submitProgress(new InstallProgress("Loading metadata", 1, 2));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Big oof
}
ui.submitProgress(new InstallProgress("Loading magic", 2, 2));
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// Big oof
} }
protected void checkOptions() {
// TODO: implement
} }
} }