Skip to content
Merged
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
24 changes: 24 additions & 0 deletions .jbang/CloneJabRef.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import java.nio.file.Files;
import java.nio.file.Path;

///usr/bin/env jbang "$0" "$@" ; exit $?

//JAVA 24
//RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED

//DEPS org.eclipse.jgit:org.eclipse.jgit.pgm:7.2.1.202505142326-r

public class CloneJabRef {
public static void main(String[] noArgs) throws Exception {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 'throws Exception' is too broad and not specific. It is better to specify the exact exceptions that might be thrown to improve code readability and maintainability.

Path targetDir = Path.of(System.getProperty("java.io.tmpdir"), "JabRef");
if (Files.exists(targetDir)) {
System.out.println("Directory already exists: " + targetDir);
return;
}

String[] args = {"clone", "https://github.com/JabRef/jabref.git", "--recurse-submodules", targetDir.toString()};
org.eclipse.jgit.pgm.Main.main(args);

System.out.println("JabRef code available at: " + targetDir);
}
}