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

52 lines
1.4 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);
} else if (args[0].contentEquals("--help")) {
CommandLine cmd = new CommandLine(new Help());
cmd.execute(args);
} else {
System.out.println(args[0] + " : command not found");
}
} catch (ArrayIndexOutOfBoundsException e) {
CommandLine cmd = new CommandLine(new Help());
System.out.println(cmd.execute(args));
}
}
}