diff --git a/cli/pom.xml b/cli/pom.xml
index c8ad09e..8a00223 100644
--- a/cli/pom.xml
+++ b/cli/pom.xml
@@ -10,25 +10,30 @@
pirilampo-cli
+ 1.2.0
+
+ com.github.clagomess.pirilampo
+ pirilampo-core
+ 1.2.0
+
+
commons-cli
commons-cli
- 1.3.1
+ 1.5.0
-
diff --git a/cli/src/main/java/com/github/clagomess/pirilampo/cli/Main.java b/cli/src/main/java/com/github/clagomess/pirilampo/cli/Main.java
index 0934c24..37f9b92 100644
--- a/cli/src/main/java/com/github/clagomess/pirilampo/cli/Main.java
+++ b/cli/src/main/java/com/github/clagomess/pirilampo/cli/Main.java
@@ -1,13 +1,10 @@
package com.github.clagomess.pirilampo.cli;
-import br.com.pirilampo.bean.Parametro;
-import br.com.pirilampo.core.Compilador;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.cli.*;
@Slf4j
public class Main {
-
+ /*
public static void main(String[] args) throws Exception {
Main main = new Main();
log.info("Pirilampo - Ver.: {}", main.getVersion());
@@ -71,4 +68,5 @@ private static CommandLine consoleOptions(String[] args){
private synchronized String getVersion(){
return getClass().getPackage().getImplementationVersion();
}
+ */
}
diff --git a/cli/src/main/java/com/github/clagomess/pirilampo/cli/MainOptions.java b/cli/src/main/java/com/github/clagomess/pirilampo/cli/MainOptions.java
new file mode 100644
index 0000000..7b5346f
--- /dev/null
+++ b/cli/src/main/java/com/github/clagomess/pirilampo/cli/MainOptions.java
@@ -0,0 +1,188 @@
+package com.github.clagomess.pirilampo.cli;
+
+import com.github.clagomess.pirilampo.core.dto.ParametersDto;
+import com.github.clagomess.pirilampo.core.enums.CompilationArctifactEnum;
+import com.github.clagomess.pirilampo.core.enums.CompilationTypeEnum;
+import com.github.clagomess.pirilampo.core.enums.HtmlPanelToggleEnum;
+import com.github.clagomess.pirilampo.core.enums.LayoutPdfEnum;
+import org.apache.commons.cli.*;
+
+import java.io.File;
+import java.util.Arrays;
+
+public class MainOptions {
+ private final ParametersDto defaultParameters = new ParametersDto();
+
+ private final Option projectName = Option.builder()
+ .option("projectName")
+ .desc(String.format(
+ "Project Name. Default: %s",
+ defaultParameters.getProjectName()
+ ))
+ .hasArg().build();
+
+ private final Option projectVersion = Option.builder()
+ .option("projectVersion")
+ .desc(String.format(
+ "Project Version. Default: %s",
+ defaultParameters.getProjectVersion()
+ ))
+ .hasArg().build();
+
+ private final Option projectLogo = Option.builder()
+ .option("projectLogo")
+ .desc("Image file for logo")
+ .hasArg().build();
+
+ private final Option layoutPdf = Option.builder()
+ .option("layoutPdf")
+ .desc(String.format(
+ "Layout PDF. Expected values: %s. Default: %s",
+ Arrays.toString(LayoutPdfEnum.values()),
+ defaultParameters.getLayoutPdf()
+ ))
+ .hasArg().build();
+
+ private final Option htmlPanelToggle = Option.builder()
+ .option("htmlPanelToggle")
+ .desc(String.format(
+ "Panel Toggle. Expected values: %s. Default: %s",
+ Arrays.toString(HtmlPanelToggleEnum.values()),
+ defaultParameters.getHtmlPanelToggle()
+ ))
+ .hasArg().build();
+
+ private final Option menuColor = Option.builder()
+ .option("menuColor")
+ .desc(String.format(
+ "Menu Color. Default: %s",
+ defaultParameters.getMenuColor()
+ ))
+ .hasArg().build();
+
+ private final Option menuTextColor = Option.builder()
+ .option("menuTextColor")
+ .desc(String.format(
+ "Menu Text Color. Default: %s",
+ defaultParameters.getMenuTextColor()
+ ))
+ .hasArg().build();
+
+ private final Option disableEmbedImages = Option.builder()
+ .option("disableEmbedImages")
+ .desc("Disable Emded Images?")
+ .build();
+
+ private final Option compilationType = Option.builder()
+ .option("compilationType")
+ .desc(String.format(
+ "Compilation Type. Expected values: %s. Default: %s",
+ Arrays.toString(CompilationTypeEnum.values()),
+ defaultParameters.getCompilationType()
+ ))
+ .hasArg().build();
+
+ private final Option compilationArctifact = Option.builder()
+ .option("compilationArctifact")
+ .desc(String.format(
+ "Compilation Arctifact. Expected values: %s. Default: %s",
+ Arrays.toString(CompilationArctifactEnum.values()),
+ defaultParameters.getCompilationArctifact()
+ ))
+ .hasArg().build();
+
+ private final Option projectSource = Option.builder()
+ .option("projectSource")
+ .desc("Folder or *.feature")
+ .hasArg().required().build();
+
+ private final Option projectMasterSource = Option.builder()
+ .option("projectMasterSource")
+ .desc("Folder to compare")
+ .hasArg().build();
+
+ private final Option projectTarget = Option.builder()
+ .option("projectTarget")
+ .desc("Target Folder")
+ .hasArg().build();
+
+ private final Options options = new Options(){{
+ addOption(projectName);
+ addOption(projectVersion);
+ addOption(projectLogo);
+ addOption(layoutPdf);
+ addOption(htmlPanelToggle);
+ addOption(menuColor);
+ addOption(menuTextColor);
+ addOption(disableEmbedImages);
+ addOption(compilationType);
+ addOption(compilationArctifact);
+ addOption(projectSource);
+ addOption(projectMasterSource);
+ addOption(projectTarget);
+ }};
+
+ public ParametersDto getArgs(String[] argv){
+ try {
+ CommandLine cmd = new DefaultParser().parse(options, argv);
+ ParametersDto parameters = new ParametersDto();
+
+ if(cmd.hasOption(projectName)) {
+ parameters.setProjectName(cmd.getOptionValue(projectName));
+ }
+
+ if(cmd.hasOption(projectVersion)) {
+ parameters.setProjectVersion(cmd.getOptionValue(projectVersion));
+ }
+
+ if(cmd.hasOption(projectLogo)) {
+ parameters.setProjectLogo(new File(cmd.getOptionValue(projectLogo)));
+ }
+
+ if(cmd.hasOption(layoutPdf)) {
+ parameters.setLayoutPdf(LayoutPdfEnum.valueOf(cmd.getOptionValue(layoutPdf)));
+ }
+
+ if(cmd.hasOption(htmlPanelToggle)) {
+ parameters.setHtmlPanelToggle(HtmlPanelToggleEnum.valueOf(cmd.getOptionValue(htmlPanelToggle)));
+ }
+
+ if(cmd.hasOption(menuColor)) {
+ parameters.setMenuColor(cmd.getOptionValue(menuColor));
+ }
+
+ if(cmd.hasOption(menuTextColor)) {
+ parameters.setMenuTextColor(cmd.getOptionValue(menuTextColor));
+ }
+
+ if(cmd.hasOption(disableEmbedImages)) {
+ parameters.setEmbedImages(false);
+ }
+
+ if(cmd.hasOption(compilationType)) {
+ parameters.setCompilationType(CompilationTypeEnum.valueOf(cmd.getOptionValue(compilationType)));
+ }
+
+ if(cmd.hasOption(compilationArctifact)) {
+ parameters.setCompilationArctifact(CompilationArctifactEnum.valueOf(cmd.getOptionValue(compilationArctifact)));
+ }
+
+ parameters.setProjectSource(new File(cmd.getOptionValue(projectSource)));
+
+ if(cmd.hasOption(projectMasterSource)) {
+ parameters.setProjectMasterSource(new File(cmd.getOptionValue(projectMasterSource)));
+ }
+
+ if(cmd.hasOption(projectTarget)) {
+ parameters.setProjectTarget(new File(cmd.getOptionValue(projectTarget)));
+ }
+
+ return parameters;
+ } catch (ParseException e) {
+ System.out.println(e.getMessage());
+ new HelpFormatter().printHelp("Pirilampo", options);
+ System.exit(1);
+ return null;
+ }
+ }
+}
diff --git a/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainOptionsTest.java b/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainOptionsTest.java
new file mode 100644
index 0000000..c5d80aa
--- /dev/null
+++ b/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainOptionsTest.java
@@ -0,0 +1,16 @@
+package com.github.clagomess.pirilampo.cli;
+
+import com.ginsberg.junit.exit.ExpectSystemExitWithStatus;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.jupiter.api.Test;
+
+@Slf4j
+public class MainOptionsTest {
+ private final MainOptions mainOptions = new MainOptions();
+
+ @Test
+ @ExpectSystemExitWithStatus(1)
+ public void getArgs(){
+ mainOptions.getArgs(new String[]{"-projectLogo", "aaa"});
+ }
+}
diff --git a/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainTest.java b/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainTest.java
index d21b95c..334827b 100644
--- a/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainTest.java
+++ b/cli/src/test/java/com/github/clagomess/pirilampo/cli/MainTest.java
@@ -2,16 +2,14 @@
import com.github.clagomess.pirilampo.cli.Main;
import lombok.extern.slf4j.Slf4j;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.contrib.java.lang.system.ExpectedSystemExit;
+import org.junit.jupiter.api.Test;
import java.io.File;
import java.util.Calendar;
@Slf4j
public class MainTest {
+ /*
@Rule
public final ExpectedSystemExit exit = ExpectedSystemExit.none();
@@ -67,4 +65,5 @@ public void testMain() throws Exception {
});
Assert.assertTrue((new File(outDir + File.separator + "xxx.html")).isFile());
}
+ */
}
diff --git a/core/pom.xml b/core/pom.xml
index 2802c9c..547648c 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -10,6 +10,7 @@
pirilampo-core
+ 1.2.0
5.5.12
@@ -76,4 +77,23 @@
test
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+
+
+
+
diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/dto/ParametersDto.java b/core/src/main/java/com/github/clagomess/pirilampo/core/dto/ParametersDto.java
index b736425..1a8893a 100644
--- a/core/src/main/java/com/github/clagomess/pirilampo/core/dto/ParametersDto.java
+++ b/core/src/main/java/com/github/clagomess/pirilampo/core/dto/ParametersDto.java
@@ -18,7 +18,7 @@ public class ParametersDto {
private String projectVersion = "1.0";
private File projectLogo;
private LayoutPdfEnum layoutPdf = LayoutPdfEnum.PORTRAIT;
- private HtmlPanelToggleEnum htmlPanelToggle = HtmlPanelToggleEnum.OPEN;
+ private HtmlPanelToggleEnum htmlPanelToggle = HtmlPanelToggleEnum.OPENED;
private String menuColor = "#14171A";
private String menuTextColor = "#DDDDDD";
private Boolean embedImages = true;
diff --git a/core/src/main/java/com/github/clagomess/pirilampo/core/enums/HtmlPanelToggleEnum.java b/core/src/main/java/com/github/clagomess/pirilampo/core/enums/HtmlPanelToggleEnum.java
index 1a30553..105a50d 100644
--- a/core/src/main/java/com/github/clagomess/pirilampo/core/enums/HtmlPanelToggleEnum.java
+++ b/core/src/main/java/com/github/clagomess/pirilampo/core/enums/HtmlPanelToggleEnum.java
@@ -7,5 +7,5 @@
@RequiredArgsConstructor
public enum HtmlPanelToggleEnum {
CLOSED,
- OPEN,
+ OPENED,
}
diff --git a/gui/pom.xml b/gui/pom.xml
index 4497f0f..c48f1b9 100644
--- a/gui/pom.xml
+++ b/gui/pom.xml
@@ -10,11 +10,20 @@
pirilampo-gui
+ 1.2.0
+
+
+ com.github.clagomess.pirilampo
+ pirilampo-core
+ 1.2.0
+
+
+
${project.artifactId}
diff --git a/pom.xml b/pom.xml
index c5749ff..db27f16 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,6 +22,7 @@
UTF-8
1.8
1.8
+ 3.7.0
1.18.24
5.8.2