Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import org.apache.commons.cli.Option;
  2. import org.apache.commons.cli.Options;
  3.  
  4. /**
  5. * Created by Jeppe on 2017-03-30.
  6. */
  7. public class Menu {
  8.  
  9. /*
  10. This method holds all the function for the menu in the program.
  11. */
  12. public void ShowMenu() {
  13. for(Object obj : MenuItems().getOptions()) {
  14. Option opt = (Option) obj;
  15. if(opt.hasArg()) {
  16. System.out.println(String.format("-%s %s: %s", opt.getOpt(), opt.getLongOpt(), opt.getDescription()));
  17. } else {
  18. System.out.println("Error while loading menuitems.");
  19. }
  20. }
  21. }
  22.  
  23. private Options MenuItems() {
  24. Options options = new Options();
  25. options.addOption("s", "Show all commands", true, "Option A");
  26. options.addOption("sl", "Selects * from choosen table", true, "Option B");
  27. return options;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement