diff --git a/pj-cli/.gitignore b/pj-cli/.gitignore
new file mode 100644
index 0000000..cf5d013
--- /dev/null
+++ b/pj-cli/.gitignore
@@ -0,0 +1,8 @@
+/.project
+/.classpath
+/.settings/
+/target/
+/bulldozer-temp.json
+/bulldozer-state.json
+/.factorypath
+/dependency-reduced-pom.xml
diff --git a/pj-cli/pom.xml b/pj-cli/pom.xml
new file mode 100644
index 0000000..a92c806
--- /dev/null
+++ b/pj-cli/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ pj-cli
+
+
+ com.g2forge.project
+ pj-project
+ 0.0.2-SNAPSHOT
+ ../pj-project/pom.xml
+
+
+ Project CLI
+ Command line interface for Project.
+
+
+
+ com.g2forge.project
+ pj-plan
+ ${project.version}
+
+
+ com.g2forge.project
+ pj-create
+ ${project.version}
+
+
+ com.g2forge.project
+ pj-report
+ ${project.version}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 3.5.3
+
+
+ package
+
+ shade
+
+
+
+
+
+ com.g2forge.project.cli.Project
+
+
+
+
+
+
+
+
+
diff --git a/pj-cli/src/main/java/com/g2forge/project/cli/Project.java b/pj-cli/src/main/java/com/g2forge/project/cli/Project.java
new file mode 100644
index 0000000..ac103ed
--- /dev/null
+++ b/pj-cli/src/main/java/com/g2forge/project/cli/Project.java
@@ -0,0 +1,12 @@
+package com.g2forge.project.cli;
+
+import com.g2forge.alexandria.command.command.DispatchCommand;
+import com.g2forge.alexandria.command.command.IStandardCommand;
+import com.g2forge.alexandria.command.command.IStructuredCommand;
+import com.g2forge.project.core.IProjectCommand;
+
+public class Project implements IStructuredCommand {
+ public static void main(String[] args) throws Throwable {
+ IStandardCommand.main(args, DispatchCommand.createAnnotation(IProjectCommand.class));
+ }
+}
diff --git a/pj-core/src/main/java/com/g2forge/project/core/IProjectCommand.java b/pj-core/src/main/java/com/g2forge/project/core/IProjectCommand.java
new file mode 100644
index 0000000..41b5a71
--- /dev/null
+++ b/pj-core/src/main/java/com/g2forge/project/core/IProjectCommand.java
@@ -0,0 +1,5 @@
+package com.g2forge.project.core;
+
+import com.g2forge.alexandria.command.command.IStandardCommand;
+
+public interface IProjectCommand extends IStandardCommand {}
diff --git a/pj-create/src/main/java/com/g2forge/project/plan/create/Create.java b/pj-create/src/main/java/com/g2forge/project/plan/create/Create.java
index 087fe8e..5596668 100644
--- a/pj-create/src/main/java/com/g2forge/project/plan/create/Create.java
+++ b/pj-create/src/main/java/com/g2forge/project/plan/create/Create.java
@@ -33,6 +33,7 @@
import com.atlassian.jira.rest.client.api.domain.input.TransitionInput;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;
+import com.g2forge.alexandria.annotations.service.Service;
import com.g2forge.alexandria.command.command.IStandardCommand;
import com.g2forge.alexandria.command.exit.IExit;
import com.g2forge.alexandria.command.invocation.CommandInvocation;
@@ -46,6 +47,7 @@
import com.g2forge.gearbox.jira.JiraAPI;
import com.g2forge.gearbox.jira.fields.KnownField;
import com.g2forge.project.core.HConfig;
+import com.g2forge.project.core.IProjectCommand;
import com.g2forge.project.core.Server;
import com.g2forge.project.plan.create.CreateIssue.CreateIssueBuilder;
import com.google.common.base.Objects;
@@ -153,7 +155,8 @@
*
*
*/
-public class Create implements IStandardCommand {
+@Service(IProjectCommand.class)
+public class Create implements IProjectCommand {
@Data
@Builder
@AllArgsConstructor
diff --git a/pj-plan/src/main/java/com/g2forge/project/plan/Plan.java b/pj-plan/src/main/java/com/g2forge/project/plan/Plan.java
index ea14cc8..6d1335a 100644
--- a/pj-plan/src/main/java/com/g2forge/project/plan/Plan.java
+++ b/pj-plan/src/main/java/com/g2forge/project/plan/Plan.java
@@ -1,13 +1,30 @@
package com.g2forge.project.plan;
+import java.io.InputStream;
+import java.io.PrintStream;
+
+import com.g2forge.alexandria.annotations.service.Service;
import com.g2forge.alexandria.command.command.DispatchCommand;
import com.g2forge.alexandria.command.command.IStructuredCommand;
+import com.g2forge.alexandria.command.exit.IExit;
+import com.g2forge.alexandria.command.invocation.CommandInvocation;
+import com.g2forge.project.core.IProjectCommand;
-public class Plan implements IStructuredCommand {
- public static void main(String[] args) throws Throwable {
+@Service(IProjectCommand.class)
+public class Plan implements IProjectCommand, IStructuredCommand {
+ protected static DispatchCommand.ManualBuilder build() {
final DispatchCommand.ManualBuilder builder = new DispatchCommand.ManualBuilder();
builder.command(new Download(), "download");
builder.command(new Sprints(), "sprints");
- builder.main(args);
+ return builder;
+ }
+
+ public static void main(String[] args) throws Throwable {
+ build().main(args);
+ }
+
+ @Override
+ public IExit invoke(CommandInvocation, InputStream, PrintStream> invocation) throws Throwable {
+ return build().invoke(invocation);
}
}
diff --git a/pj-report/src/main/java/com/g2forge/project/report/Billing.java b/pj-report/src/main/java/com/g2forge/project/report/Billing.java
index 7e727d9..a84c94b 100644
--- a/pj-report/src/main/java/com/g2forge/project/report/Billing.java
+++ b/pj-report/src/main/java/com/g2forge/project/report/Billing.java
@@ -35,6 +35,7 @@
import com.atlassian.jira.rest.client.api.domain.User;
import com.g2forge.alexandria.adt.associative.cache.Cache;
import com.g2forge.alexandria.adt.associative.cache.NeverCacheEvictionPolicy;
+import com.g2forge.alexandria.annotations.service.Service;
import com.g2forge.alexandria.command.command.IStandardCommand;
import com.g2forge.alexandria.command.exit.IExit;
import com.g2forge.alexandria.command.invocation.CommandInvocation;
@@ -45,6 +46,7 @@
import com.g2forge.alexandria.java.function.IFunction1;
import com.g2forge.alexandria.java.function.IPredicate1;
import com.g2forge.alexandria.java.function.builder.IBuilder;
+import com.g2forge.alexandria.java.io.dataaccess.PathDataSink;
import com.g2forge.alexandria.java.io.dataaccess.PathDataSource;
import com.g2forge.alexandria.log.HLog;
import com.g2forge.alexandria.match.HMatch;
@@ -54,6 +56,7 @@
import com.g2forge.gearbox.jira.JiraAPI;
import com.g2forge.gearbox.jira.fields.KnownField;
import com.g2forge.project.core.HConfig;
+import com.g2forge.project.core.IProjectCommand;
import com.g2forge.project.core.Server;
import lombok.AllArgsConstructor;
@@ -64,7 +67,8 @@
import lombok.extern.slf4j.Slf4j;
@Slf4j
-public class Billing implements IStandardCommand {
+@Service(IProjectCommand.class)
+public class Billing implements IProjectCommand {
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@@ -327,7 +331,7 @@ public IExit invoke(CommandInvocation, InputStream, PrintStream> invocation) t
final String filename = Filename.fromPath(arguments.getRequest()).getPrefix().toString() + " (" + DATE_FORMAT_FILENAME.format(request.getStart()) + " to " + DATE_FORMAT_FILENAME.format(request.getEnd()) + ").csv";
final Path outputFile = outputDirectory.resolve(filename);
log.info("Writing bill to {}", outputFile);
- BillLine.getMapper().write(billLines, outputFile);
+ BillLine.getMapper().write(billLines, new PathDataSink(outputFile));
}
log.info("Bill by user");
diff --git a/pom.xml b/pom.xml
index 1ffc36e..6047163 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,5 +21,6 @@
pj-create
pj-plan
pj-report
+ pj-cli