M332-PT-NGCC/NGCC/src/Exec.java

53 lines
1.5 KiB
Java
Raw Normal View History

2019-09-10 21:42:03 +02:00
import commands.*;
import picocli.CommandLine;
public class Exec {
public static void main(String[] args) {
try {
if (args[0].contentEquals("-b") || args[0].contentEquals("--build")) {
CommandLine cmd = new CommandLine(new Build());
cmd.execute(args);
} else if (args[0].contentEquals("-r") || args[0].contentEquals("--read")) {
CommandLine cmd = new CommandLine(new Read());
cmd.execute(args);
} else if (args[0].contentEquals("-g") || args[0].contentEquals("--generate")) {
CommandLine cmd = new CommandLine(new Generate());
cmd.execute(args);
} else if (args[0].contentEquals("-p") || args[0].contentEquals("--produce")) {
CommandLine cmd = new CommandLine(new Produce());
cmd.execute(args);
} else if (args[0].contentEquals("-a") || args[0].contentEquals("--analyse")) {
CommandLine cmd = new CommandLine(new Analyse());
cmd.execute(args);
} else if (args[0].contentEquals("-e") || args[0].contentEquals("--evaluate")) {
CommandLine cmd = new CommandLine(new Evaluate());
cmd.execute(args);
2019-09-11 09:37:12 +02:00
} else if (args[0].contentEquals("help") || args[0].contentEquals("--help")) {
2019-09-10 21:42:03 +02:00
CommandLine cmd = new CommandLine(new Help());
cmd.execute(args);
} else {
2019-09-11 09:37:12 +02:00
System.err.println("NGCC: "+args[0] + " : command not found");
2019-09-10 21:42:03 +02:00
}
2019-09-11 10:08:17 +02:00
2019-09-10 21:42:03 +02:00
} catch (ArrayIndexOutOfBoundsException e) {
CommandLine cmd = new CommandLine(new Help());
System.out.println(cmd.execute(args));
}
}
}