Skip to content

Commit

Permalink
Merge pull request #166 from cmu-phil/cli-validations
Browse files Browse the repository at this point in the history
Cli validations
  • Loading branch information
jdramsey committed Mar 25, 2016
2 parents 7cac6af + 5042ad5 commit 4ce0fed
Show file tree
Hide file tree
Showing 48 changed files with 16 additions and 11 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 1 addition & 2 deletions tetrad-cli/pom.xml → causal-cmd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>tetrad</artifactId>
<version>5.3.0-SNAPSHOT</version>
</parent>
<artifactId>tetrad-cli</artifactId>
<artifactId>causal-cmd</artifactId>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
Expand Down Expand Up @@ -107,7 +107,6 @@
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>edu.cmu</groupId>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
*
Expand All @@ -36,6 +38,8 @@
*/
public class TetradCliApp {

private static final Logger LOGGER = LoggerFactory.getLogger(TetradCliApp.class);

private static final Options MAIN_OPTIONS = new Options();

static {
Expand Down Expand Up @@ -81,10 +85,13 @@ private static void showVersion() {
JarFile jarFile = new JarFile(TetradCliApp.class.getProtectionDomain().getCodeSource().getLocation().getPath(), true);
Manifest manifest = jarFile.getManifest();
Attributes attributes = manifest.getMainAttributes();
String artifactId = attributes.getValue("Implementation-Title");
String version = attributes.getValue("Implementation-Version");
System.out.printf("Tetrad Command-line Interface (CLI) version %s%n", version);
System.out.printf("%s version: %s%n", artifactId, version);
} catch (IOException exception) {
System.err.println("Unable to retrieve version number.");
String errMsg = "Unable to retrieve version number.";
System.err.println(errMsg);
LOGGER.error(errMsg, exception);
}
}

Expand All @@ -98,7 +105,7 @@ private static void showHelp() {
String version = attributes.getValue("Implementation-Version");
cmdLineSyntax += String.format("%s-%s.jar", artifactId, version);
} catch (IOException exception) {
cmdLineSyntax += "tetrad-cli.jar";
cmdLineSyntax += "causal-cmd.jar";
}

HelpFormatter formatter = new HelpFormatter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ private static void printArgs(PrintStream writer) {
formatter.format("data=%s,", dataFile.getFileName());
}
if (variableFile != null) {
writer.printf("variables = %s%n", variableFile.getFileName());
formatter.format("variables=%s,", variableFile.getFileName());
writer.printf("excluded variables = %s%n", variableFile.getFileName());
formatter.format("excluded variables=%s,", variableFile.getFileName());
}
if (knowledgeFile != null) {
writer.printf("knowledge = %s%n", knowledgeFile.getFileName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
log4j.rootLogger=INFO,file

log4j.appender.file.File=tetrad-cli.log
log4j.appender.file.File=causal-cmd.log
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.MaxFileSize=10MB
log4j.appender.file.MaxBackupIndex=10
Expand Down
File renamed without changes.
File renamed without changes.
5 changes: 2 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>edu.cmu</groupId>
<artifactId>tetrad</artifactId>
Expand All @@ -12,8 +11,8 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<name>Tetrad Project</name>
<modules>
<module>tetrad-gui</module>
<module>tetrad-cli</module>
<module>tetrad-lib</module>
<module>causal-cmd</module>
</modules>

<licenses>
Expand Down

0 comments on commit 4ce0fed

Please sign in to comment.