Skip to content

Commit 86ea9d2

Browse files
committed
Add default for file export
1 parent 3ee53a4 commit 86ea9d2

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/main/java/org/hydev/mcpm/client/arguments/parsers/ExportPluginsParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public String description()
3434
@Override
3535
public void configure(Subparser parser)
3636
{
37-
parser.addArgument("type").nargs("?").setDefault("pastebin") // type of output
37+
parser.addArgument("type").nargs("?").choices("pastebin", "file", "literal")
38+
.setDefault("pastebin") // type of output
3839
.type(String.class).dest("type"); // of type OutputStream
3940
parser.addArgument("out").nargs("?")
4041
.type(String.class).dest("out");

src/main/java/org/hydev/mcpm/client/export/storage/StringLiteralStorage.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import java.io.IOException;
44

5+
/**
6+
* A StringStorage where the token is literally the content itself.
7+
*/
58
public class StringLiteralStorage implements StringStorage {
69
@Override
710
public String store(String content) {

src/main/java/org/hydev/mcpm/client/export/storage/StringStorageFactory.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,20 @@
44

55

66
/**
7-
*
7+
* Factory for creating StringStorage instances for ExportInteractor
88
*/
99
public class StringStorageFactory {
10+
/**
11+
* Create a StringStorage based on the export type.
12+
*
13+
* @param input The export query
14+
* @return a StringStorage satisfying the query
15+
*/
1016
public static StringStorage createStringStorage(ExportPluginsInput input) {
1117
return switch (input.type()) {
12-
case "file" -> new FixedFileStorage(input.out());
18+
case "file" -> input.out() == null ?
19+
new FixedFileStorage("export.json") : new FixedFileStorage(input.out());
20+
1321
case "pastebin" -> input.out() == null ? new PasteBinStorage() : new PasteBinStorage(input.out());
1422
case "literal" -> new StringLiteralStorage();
1523
default -> throw new IllegalArgumentException("Invalid output type");

tools/start_server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def update_build(mc_path: Path):
6666

6767
if __name__ == '__main__':
6868
# Download JDK
69-
java = ensure_java("19")
69+
# java = ensure_java("19")
70+
java = Path("/Users/Peter/Library/Java/JavaVirtualMachines/temurin-19/Contents/Home/bin/java")
7071

7172
# Download server tar
7273
mc_path = Path('build/mc-server')

0 commit comments

Comments
 (0)