Skip to content
Snippets Groups Projects
Commit 984def21 authored by Jack Maclauchlan's avatar Jack Maclauchlan
Browse files

added some cli code

parent 9f15e45c
No related branches found
No related tags found
No related merge requests found
package application;
import command.CommandSelector;
public class DDITApplication {
public static void main(String[] args) {
CommandSelector commandSelector = new CommandSelector();
commandSelector.executeCommand();
}
}
package cli;
import org.apache.commons.cli.*;
public class CommandLineInterface {
private Options options;
private String[] userInput;
public CommandLineInterface(String[] userInput){
this.options = new Options();
this.userInput = userInput;
options.addOption("create", "create an issue");
options.addOption("push", "push issues");
}
public CommandLine getInput() throws ParseException {
CommandLineParser parser = new DefaultParser();
return parser.parse(options, userInput);
}
}
......@@ -2,9 +2,8 @@ package command;
public class CommandSelector {
private Command command = null;
public void executeCommand(String enteredCommand) {
Command command; //possibly make field
if (enteredCommand.equals("issue")) {
command = createIssue();
} else if (enteredCommand.equals("push")) {
......@@ -12,7 +11,6 @@ public class CommandSelector {
} else {
command = help();
}
command.execute();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment