Skip to content

Commit

Permalink
Tidy and expand qc help
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbattle committed Dec 3, 2023
1 parent 2dbfbc8 commit 4be9e80
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 45 deletions.
34 changes: 34 additions & 0 deletions quickcheck/src/main/java/quickcheck/QuickCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static com.fujitsu.vdmj.plugins.PluginConsole.errorln;
import static com.fujitsu.vdmj.plugins.PluginConsole.infof;
import static com.fujitsu.vdmj.plugins.PluginConsole.infoln;
import static com.fujitsu.vdmj.plugins.PluginConsole.println;
import static com.fujitsu.vdmj.plugins.PluginConsole.verbose;
import static quickcheck.commands.QCConsole.infof;
import static quickcheck.commands.QCConsole.infoln;
Expand Down Expand Up @@ -804,4 +805,37 @@ private String duration(long before, long after)
double duration = (double)(after - before)/1000;
return "in " + duration + "s";
}

public void printHelp(String USAGE)
{
println(USAGE);
println("");
println(" -?|-help - show command help");
println(" -q - run with minimal output (quiet)");
println(" -t <secs> - timeout in secs");
println(" -i <status> - only show this result status");
println(" -s <strategy> - enable this strategy (below)");
println(" -<strategy:option> - pass option to strategy");
println(" PO# numbers - only process these POs");
println(" PO# - PO# - process a range of POs");
println(" <pattern> - process PO names or modules matching");
println("");
println("Enabled strategies:");

for (QCStrategy strategy: getEnabledStrategies())
{
println(" " + strategy.help());
}

if (!getDisabledStrategies().isEmpty())
{
println("");
println("Disabled strategies (add with -s <name>):");

for (QCStrategy strategy: getDisabledStrategies())
{
println(" " + strategy.help());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

package quickcheck.commands;

import static quickcheck.commands.QCConsole.errorln;
import static quickcheck.commands.QCConsole.println;
import static com.fujitsu.vdmj.plugins.PluginConsole.errorln;
import static com.fujitsu.vdmj.plugins.PluginConsole.println;

import java.util.Arrays;
import java.util.List;
Expand All @@ -43,7 +43,6 @@
import com.fujitsu.vdmj.pog.ProofObligationList;

import quickcheck.QuickCheck;
import quickcheck.strategies.QCStrategy;
import quickcheck.strategies.StrategyResults;

public class QuickCheckCommand extends AnalysisCommand
Expand Down Expand Up @@ -93,24 +92,7 @@ public String run(String line)
{
case "-?":
case "-help":
println(USAGE);
println("Enabled strategies:");

for (QCStrategy strategy: qc.getEnabledStrategies())
{
println(" " + strategy.help());
}

if (!qc.getDisabledStrategies().isEmpty())
{
println("Disabled strategies (add with -s <name>):");

for (QCStrategy strategy: qc.getDisabledStrategies())
{
println(" " + strategy.help());
}
}

qc.printHelp(USAGE);
return null;

case "-q":
Expand All @@ -123,10 +105,9 @@ public String run(String line)
break;

case "-i":
i++;

try
{
i++;
includes.add(POStatus.valueOf(arglist.get(i).toUpperCase()));
}
catch (IllegalArgumentException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
package quickcheck.commands;

import static com.fujitsu.vdmj.plugins.PluginConsole.errorln;
import static com.fujitsu.vdmj.plugins.PluginConsole.println;

import java.io.IOException;
import java.util.Arrays;
Expand All @@ -38,7 +37,6 @@
import dap.DAPRequest;
import json.JSONObject;
import quickcheck.QuickCheck;
import quickcheck.strategies.QCStrategy;
import vdmj.commands.AnalysisCommand;
import vdmj.commands.InitRunnable;
import vdmj.commands.ScriptRunnable;
Expand Down Expand Up @@ -98,24 +96,7 @@ private DAPMessageList setup(DAPRequest request)
{
case "-?":
case "-help":
println(USAGE);
println("Enabled strategies:");

for (QCStrategy strategy: qc.getEnabledStrategies())
{
println(" " + strategy.help());
}

if (!qc.getDisabledStrategies().isEmpty())
{
println("Disabled strategies (add with -s <name>):");

for (QCStrategy strategy: qc.getDisabledStrategies())
{
println(" " + strategy.help());
}
}

qc.printHelp(USAGE);
return result(request, null);

case "-q":
Expand All @@ -128,10 +109,9 @@ private DAPMessageList setup(DAPRequest request)
break;

case "-i":
i++;

try
{
i++;
includes.add(POStatus.valueOf(arglist.get(i).toUpperCase()));
}
catch (IllegalArgumentException e)
Expand Down

0 comments on commit 4be9e80

Please sign in to comment.