Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI option to install client #1

Merged
merged 3 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.guardsquare:proguard-gradle:7.1.0'
classpath 'com.guardsquare:proguard-gradle:7.4.1'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public static void main(String[] args) throws IOException, URISyntaxException
}

OptionParser parser = new OptionParser();
OptionSpec<File> serverInstallOption = parser.accepts("installServer", "Install a server to the current directory").withOptionalArg().ofType(File.class).defaultsTo(new File("."));
OptionSpec<File> clientInstallOption = parser.acceptsAll(Arrays.asList("installClient", "install-client"), "Install a client to the specified directory, defaulting to the MC installation directory").withOptionalArg().ofType(File.class).defaultsTo(getMCDir());
OptionSpec<File> serverInstallOption = parser.acceptsAll(Arrays.asList("installServer", "install-server"), "Install a server to the current directory").withOptionalArg().ofType(File.class).defaultsTo(new File("."));
OptionSpec<File> extractOption = parser.accepts("extract", "Extract the contained jar file to the specified directory").withOptionalArg().ofType(File.class).defaultsTo(new File("."));
OptionSpec<Void> helpOption = parser.acceptsAll(Arrays.asList("h", "help"),"Help with this installer");
OptionSpec<Void> offlineOption = parser.accepts("offline", "Don't attempt any network calls");
Expand All @@ -110,8 +111,7 @@ public static void main(String[] args) throws IOException, URISyntaxException
else
{
for(String host : new String[] {
"files.minecraftforge.net",
"maven.minecraftforge.net",
"maven.neoforged.net",
"libraries.minecraft.net",
"launchermeta.mojang.com",
"piston-meta.mojang.com",
Expand All @@ -130,6 +130,9 @@ public static void main(String[] args) throws IOException, URISyntaxException
} else if (optionSet.has(extractOption)) {
action = Actions.EXTRACT;
target = optionSet.valueOf(extractOption);
} else if (optionSet.has(clientInstallOption)) {
action = Actions.CLIENT;
target = optionSet.valueOf(clientInstallOption);
}

if (action != null)
Expand Down