Skip to content

Commit

Permalink
get the json content from the stdin if - is given for -json parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Oct 3, 2016
1 parent 2d67b1f commit 33fed51
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ out/
# Can be used for repackaging with semantic information
libs/
/bin/

.classpath
.project
.settings/
17 changes: 15 additions & 2 deletions src/main/java/com/ericsson/eiffel/remrem/generate/cli/CLI.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.ericsson.eiffel.remrem.generate.cli;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
Expand All @@ -16,6 +18,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.reader.StreamReader;
import org.springframework.boot.CommandLineRunner;

import com.ericsson.eiffel.remrem.semantics.SemanticsService;
Expand Down Expand Up @@ -167,8 +170,18 @@ private String readFileContent(String filePath) {
* @param commandLine
*/
private void handleJsonArgs(CommandLine commandLine) {
String jsonContent = commandLine.getOptionValue("json");
handleJsonString(jsonContent, commandLine);
String jsonContent = commandLine.getOptionValue("json");
if (jsonContent.equals("-")) {
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(System.in));
try {
jsonContent = bufferReader.readLine();
} catch (IOException e) {
e.printStackTrace();
System.exit(5);
}

}
handleJsonString(jsonContent, commandLine);
}

/**
Expand Down

0 comments on commit 33fed51

Please sign in to comment.