-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
40 lines (30 loc) · 934 Bytes
/
Main.java
File metadata and controls
40 lines (30 loc) · 934 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
37
38
39
40
import commands.*;
import core.Repository;
import core.RepositoryLoader;
public class Main {
public static Repository repository;
public static void main(String[] args) {
if (args.length == 0) {
System.out.println("No command provided.");
return;
}
// Always load repo if it exists
repository = RepositoryLoader.loadOrCreate();
switch (args[0]) {
case "init":
new InitCommand().execute();
break;
case "add":
new AddCommand(repository).execute(args);
break;
case "commit":
new CommitCommand(repository).execute(args);
break;
case "log":
new LogCommand(repository).execute();
break;
default:
System.out.println("Unknown command.");
}
}
}