Advertisement
Guest User

Untitled

a guest
May 26th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. package at.dahlgren.arma3sync;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5.  
  6. import at.dahlgren.arma3sync.commands.Command;
  7. import at.dahlgren.arma3sync.commands.CommandAddEvent;
  8. import at.dahlgren.arma3sync.commands.CommandBuild;
  9. import at.dahlgren.arma3sync.commands.CommandEvents;
  10. import at.dahlgren.arma3sync.commands.CommandNewRepository;
  11. import at.dahlgren.arma3sync.commands.CommandRemoveEvent;
  12. import at.dahlgren.arma3sync.commands.CommandSetEvents;
  13.  
  14. import com.beust.jcommander.JCommander;
  15.  
  16.  
  17. public class Main {
  18.  
  19. public static void main(String[] args) {
  20. JCommander jc = new JCommander();
  21.  
  22. Map<String, Command> commands = new HashMap<String, Command>();
  23. commands.put("addevent", new CommandAddEvent());
  24. commands.put("build", new CommandBuild());
  25. commands.put("events", new CommandEvents());
  26. commands.put("new", new CommandNewRepository());
  27. commands.put("removeevent", new CommandRemoveEvent());
  28. commands.put("setevents", new CommandSetEvents());
  29.  
  30. for (String key : commands.keySet()) {
  31. jc.addCommand(key, commands.get(key));
  32. }
  33.  
  34. jc.parse(args);
  35.  
  36. String command = jc.getParsedCommand().toLowerCase();
  37. if (commands.containsKey(command)) {
  38. commands.get(command).execute();
  39. } else {
  40. System.out.println("Command not found");
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement