-
Notifications
You must be signed in to change notification settings - Fork 0
/
GitClone.java
executable file
·46 lines (35 loc) · 1.34 KB
/
GitClone.java
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
37
38
39
40
41
42
43
44
45
46
///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r
//DEPS org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:5.12.0.202106070339-r
//DEPS info.picocli:picocli:4.6.2
//SOURCES AbstractGit.java
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
import java.io.File;
@Command(name = "GitClone", mixinStandardHelpOptions = true, version = "GitClone 0.1", description = "A basic `git clone` replacement in Java")
class GitClone extends AbstractGit {
@Parameters(arity = "0..1", index = "1", description = "The name of a new directory to clone into")
File directory;
@Option(names = {"--bare"}, description = "Make a bare Git repository")
boolean bare;
@Option(names = {"-n", "--no-checkout"}, description = "No checkout of HEAD is performed after the clone is complete")
boolean noCheckout;
public static void main(final String... args) {
int exitCode = new CommandLine(new GitClone()).execute(args);
System.exit(exitCode);
}
@Override
public File getCloneDirectory() throws Exception {
return directory;
}
@Override
public boolean isBare() {
return bare;
}
@Override
public boolean isNoCheckout() {
return noCheckout;
}
}