forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathCloneJabRef.java
More file actions
36 lines (28 loc) · 1001 Bytes
/
CloneJabRef.java
File metadata and controls
36 lines (28 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import java.nio.file.Files;
import java.nio.file.Path;
///usr/bin/env jbang "$0" "$@" ; exit $?
//JAVA 21+
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED
//DEPS org.eclipse.jgit:org.eclipse.jgit.pgm:7.3.0.202506031305-r
public class CloneJabRef {
public static void main(String[] args) throws Exception {
Path targetDir;
if (args.length == 1) {
targetDir = Path.of(args[0]).toAbsolutePath();
} else {
targetDir = Path.of(System.getProperty("java.io.tmpdir"), "jabref");
}
if (Files.exists(targetDir)) {
System.out.println("Directory already exists: " + targetDir);
return;
}
String[] jGitArgs = {
"clone",
"https://github.com/JabRef/jabref.git",
"--recurse-submodules",
targetDir.toString(),
};
org.eclipse.jgit.pgm.Main.main(jGitArgs);
System.out.println("JabRef code available at: " + targetDir);
}
}