Commit 499fbfd3 authored by Jonathan Shahen's avatar Jonathan Shahen

Adds the command '!prev' to execute the previous command: makes life easier;...

Adds the command '!prev' to execute the previous command: makes life easier; added commands for the bug hunt
parent 83849100
package mohawk.converter;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.*;
import java.util.logging.Logger;
import org.apache.commons.cli.Options;
......@@ -13,6 +12,7 @@ public class ConverterCUI {
public static final Logger logger = Logger.getLogger("mohawk");
public static FileExtensions fileExt = new FileExtensions();
public static String previousCommandFilename = "ConverterCUIPreviousCommand.txt";
public static String previousCmd;
public static void main(String[] args) {
ConverterInstance inst = new ConverterInstance();
......@@ -53,17 +53,26 @@ public class ConverterCUI {
if (cmd.equals("!exit")) {
break;
}
if (cmd.equals("!prev")) {
argv.clear();
argv.addAll(Arrays.asList(previousCmd.split(" ")));
break;
}
argv.add(cmd);
}
user_input.close();
System.out.println("Commands: " + argv);
FileWriter fw;
try {
fw = new FileWriter(previousCommandFilename, false);
fw.write(fullCommand.toString());
fw.close();
if (!cmd.equals("!prev")) {
FileWriter fw;
fw = new FileWriter(previousCommandFilename, false);
fw.write(fullCommand.toString());
fw.close();
}
} catch (IOException e) {
System.out.println("[ERROR] Unable to write out previous command to: " + previousCommandFilename);
}
......@@ -129,6 +138,11 @@ public class ConverterCUI {
+ OptionString.BULK.c() + OptionString.LOGLEVEL.c("debug") + OptionString.SPECEXT.c(".spec") + "!exit");
System.out.println("");
System.out.println(OptionString.TO_MOHAWK.c() + OptionString.SPECFILE.c("data/bug/") + OptionString.BULK.c()
+ OptionString.SPECEXT.c(".mohawk.T") + OptionString.LOGLEVEL.c("quiet") + "!exit");
System.out.println(
OptionString.TO_MOHAWK.c() + OptionString.SPECFILE.c("data/bug/isolation/") + OptionString.BULK.c()
+ OptionString.SPECEXT.c(".mohawk.T") + OptionString.LOGLEVEL.c("quiet") + "!exit");
System.out.println(OptionString.TO_MOHAWK.c() + OptionString.SPECFILE.c("data/bug/10-CA-role3.mohawk.T")
+ OptionString.LOGLEVEL.c("quiet") + "!exit");
System.out.println(OptionString.TO_MOHAWK.c() + OptionString.SPECFILE.c("data/bug/11-CA-no-role3.mohawk.T")
......@@ -137,9 +151,9 @@ public class ConverterCUI {
System.out.println("");
try {
BufferedReader bfr = new BufferedReader(new FileReader(previousCommandFilename));
String previousCmd = bfr.readLine();
previousCmd = bfr.readLine();
bfr.close();
System.out.println("Previous Command: " + previousCmd);
System.out.println("Previous Command ('!prev' to use the previous command): " + previousCmd);
} catch (IOException e) {
System.out.println("[ERROR] Unable to load previous command!");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment