Commit e30a44aa authored by Jonathan Shahen's avatar Jonathan Shahen

Adds the '!prev' command to the CUI

parent eabb06b9
package mohawk;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.*;
import org.apache.commons.cli.Options;
public class MohawkCUI {
public static String previousCommandFilename = "MohawkCUIPreviousCommand.txt";
public static String previousCmd;
public static void main(String[] args) {
MohawkInstance inst = new MohawkInstance();
......@@ -48,17 +48,25 @@ public class MohawkCUI {
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 {
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);
}
......@@ -86,12 +94,13 @@ public class MohawkCUI {
System.out.println("-mode bmc -run all -bulk -input data/testcases/mixed !exit");
System.out.println("");
System.out.println("-mode bmc -run all -input data/ahn/test.st.mohawk.T.mohawk !exit");
System.out.println("-mode bmc -run all -input data/bug/isolation/ -skiprefine -bulk !exit");
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