Skip to content
Snippets Groups Projects
Commit 9817796a authored by Jack MacLauchlan CS2015's avatar Jack MacLauchlan CS2015
Browse files

cli updated to take args for creating issues, can create orphan branch but doesnt clean directory

parent 74c24887
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ create
-------
create issue (title, description, assignees, label/tag)
git ddit -n "title" -d "hello" -a "user1, user2" -l "label"
git ddit --new
update
-------
......
......@@ -8,6 +8,11 @@
<artifactId>ddit</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-cli/commons-cli -->
<dependency>
......@@ -16,8 +21,33 @@
<version>1.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>5.2.1.201812262042-r</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>10</source>
<target>10</target>
</configuration>
</plugin>
</plugins>
</build>
......
14th January to 11th of February - Implementation:​
Development Sprint 1 (1 week): Create CLI, issue branch and basic issues​
Development Sprint 2 (1 week): Create detailed issues, view, comment on and update issues​
Development Sprint 3 (0.5 week): Basic synchronising with other repositories (ignoring merging issues)​
Development Sprint 4 (1.5 week): Complete synchronisation with other repos – all system functionality completed​
Documentation for each sprints results ​
12th of February to 21st of February - Testing:​
Create testing strategy: Black-box (unit testing), integration testing​
Fix any bugs highlighted from testing and document them​
Testing documentation (verification and validation section of report)
22nd of February to 22nd of March – Report writing:​
1st week: Create report introductory pages, introduction section and finish problem description and specification section of report ​
2nd week: System design section of report, user and technical guide, installation guide, maintenance and developer guide​
3rd week: Detailed design and implementation section of report​
4th week: Results and evaluation section, summary and conclusion of project ​
23rd of March to 25th of March - Submission:​
Report review: proof reading, formatting, polishing​
Submit project​
27th of March - Demo:​
Project Demonstration
\ No newline at end of file
......@@ -10,82 +10,68 @@ public class CommandLineInterface {
this.options = new Options();
addOptions();
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp( "git ddit -n <title> | -rm <id> | -u <id> | -c <id> ", options);
// options.addOption("create", "create an issue");
// options.addOption("push", "push issues");
formatter.printHelp( "to do", options); //todo
}
public void addOptions(){
OptionGroup uniqueCommands = new OptionGroup();
Option createIssue = Option.builder("n")
Option initialiseITS = Option.builder()
.longOpt("init")
.desc("initialise issue system")
.build();
uniqueCommands.addOption(initialiseITS);
Option createIssue = Option.builder()
.longOpt("new")
.argName("title")
.hasArg()
.desc("create new issue with given title")
.hasArgs()
.argName("TITLE> <DESCRIPTION")
.numberOfArgs(2)
.desc("create new issue")
.build();
uniqueCommands.addOption(createIssue);
Option updateIssue = Option.builder("u")
// Option createIssue = Option.builder()
// .longOpt("new")
// .hasArgs()
// .argName("<TITLE> <DESCRIPTION> [LABEL]")
// .numberOfArgs(Option.UNLIMITED_VALUES)
// .desc("create new issue")
// .build();
// uniqueCommands.addOption(createIssue);
Option updateIssue = Option.builder()
.longOpt("update")
.argName("id")
.hasArg()
.desc("update issue with given id")
.build();
uniqueCommands.addOption(updateIssue);
Option deleteIssue = Option.builder("rm")
Option deleteIssue = Option.builder()
.longOpt("remove")
.argName("id")
.hasArg()
.argName("ID")
.desc("delete issue with given id")
.build();
uniqueCommands.addOption(deleteIssue);
Option comment = Option.builder("c")
Option comment = Option.builder()
.longOpt("comment")
.argName("id")
.hasArg()
.desc("comment on issue with given id")
.build();
uniqueCommands.addOption(comment);
Option viewIssues = Option.builder("v")
.longOpt("comment")
.argName("id")
.hasArg()
.desc("comment on issue with given id")
Option viewIssues = Option.builder()
.longOpt("view")
.desc("view on issue with given id")
.build();
uniqueCommands.addOption(viewIssues);
Option description = Option.builder("d")
.longOpt("desc")
.argName("desc")
.hasArg()
.required(false)
.desc("get the description for an issue")
.build();
Option assignees = Option.builder("a")
.longOpt("assignees")
.argName("assignees")
.hasArg()
.required(false)
.desc("people assigned to an issue")
.build();
Option label = Option.builder("l")
.longOpt("label")
.argName("label")
.hasArg()
.required(false)
.desc("label assigned to an issue")
.build();
uniqueCommands.setRequired(true);
options.addOptionGroup(uniqueCommands);
options.addOption(description);
options.addOption(assignees);
options.addOption(label);
}
public CommandLine getInput(String[] userInput) throws ParseException {
......
package command;
import java.io.IOException;
public interface Command {
void execute();
}
package command;
public class CommandCreate implements Command {
private String title;
private String description;
public CommandCreate(String[] args) {
this.title = args[0];
this.description = args[1];
}
public void execute() {
System.out.println(title);
System.out.println(description);
}
}
package command;
public class CommandCreateIssue implements Command {
public void execute() {
System.out.println("Issue Created!");
}
}
package command;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import java.io.File;
import java.io.IOException;
public class CommandInit implements Command {
private String path = "/home/jack/Documents/testRepo";
public void execute() {
try (Git git = Git.open(new File(path))) {
git.checkout()
.setCreateBranch(true)
.setOrphan(true)
.setName("issues")
.call();
} catch (IOException e) {
System.out.println("Not a git repository - aborting operation");
} catch (GitAPIException e) {
e.printStackTrace();
}
}
}
// System.out.println(System.getProperty("user.dir"));
\ No newline at end of file
package command;
public class CommandPushIssue implements Command {
public class CommandPush implements Command {
public void execute() {
System.out.println("Issue pushed");
}
......
......@@ -19,30 +19,33 @@ public class CommandSelector {
try {
CommandLine userInput = commandLineInterface.getInput(enteredCommand);
Command command;
if (userInput.hasOption("n")) {
System.out.println(userInput.getOptionValue("n"));
command = createIssue();
} else if (userInput.hasOption("push")) {
command = pushIssue();
if (userInput.hasOption("new")) {
command = createIssue(userInput.getOptionValues("new"));
} else if(userInput.hasOption("init")){
command = init();
} else {
command = help();
}
command.execute();
} catch (ParseException e) {
e.printStackTrace();
e.printStackTrace(); //todo
}
}
private Command init(){
return new CommandInit();
}
private Command help() {
return new CommandHelp();
}
private Command createIssue() {
return new CommandCreateIssue();
private Command createIssue(String[] args) {
return new CommandCreate(args);
}
private Command pushIssue() {
return new CommandPushIssue();
return new CommandPush();
}
}
package issue;
public class Issue {
private String title;
private String description;
public Issue(String title, String description){
this.title = title;
this.description = description;
}
@Override
public String toString() {
return "Title: " + title + " Description: " + description;
}
}
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