Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.apache.commons.cli.Option;
- import org.apache.commons.cli.Options;
- /**
- * Created by Jeppe on 2017-03-30.
- */
- public class Menu {
- /*
- This method holds all the function for the menu in the program.
- */
- public void ShowMenu() {
- for(Object obj : MenuItems().getOptions()) {
- Option opt = (Option) obj;
- if(opt.hasArg()) {
- System.out.println(String.format("-%s %s: %s", opt.getOpt(), opt.getLongOpt(), opt.getDescription()));
- } else {
- System.out.println("Error while loading menuitems.");
- }
- }
- }
- private Options MenuItems() {
- Options options = new Options();
- options.addOption("s", "Show all commands", true, "Option A");
- options.addOption("sl", "Selects * from choosen table", true, "Option B");
- return options;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement