Verified Commit 496087d0 authored by Amin Bandali's avatar Amin Bandali
Browse files

--ignore now takes a regex for file paths

instead of a list of exact file names

also, always show default values in cli usage help
parent 25d51e0e
......@@ -32,9 +32,11 @@ import java.util.concurrent.atomic.AtomicInteger;
import com.google.gson.Gson;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
@Command(showDefaultValues = true)
public abstract class CatalystCommand {
protected transient Result r;
protected transient Gson gson;
......@@ -74,10 +76,9 @@ public abstract class CatalystCommand {
Solver.glucose, Solver.sat4j };
@Option(names = "--ignore",
split = ",",
paramLabel = "<file>",
description = "Comma-separated list of file names to be skipped")
protected String[] ignoredFiles = { "nasa_fgs_mode_logic.als" }; // takes way too long
paramLabel = "<regex>",
description = "file paths matching this regex will be skipped")
protected String ignore = "(.*)ga-optodeclspecs(.*)|nasa_fgs_mode_logic\\.als"; // takes way too long
@Option(names = "--parallel", description = "Parallel mode (use parallel streams)")
protected boolean parallel;
......
......@@ -38,7 +38,6 @@ import picocli.CommandLine.Command;
description = "A framework for analysis/optimization of performance of Alloy models.",
customSynopsis = "@|bold catalyst|@ [OPTION] COMMAND",
mixinStandardHelpOptions = true,
showDefaultValues = true,
subcommands = { SSR.class, Mut.class })
public final class MainCLI implements Runnable {
public static void main(String[] args) {
......
......@@ -133,7 +133,7 @@ public final class Mut extends CatalystCommand implements Runnable {
AtomicInteger i = new AtomicInteger(1);
Stream<Path> fs = parallel ? files.parallelStream() : files.stream();
fs.filter(p -> p.getFileName().toString().endsWith(".als"))
.filter(p -> !Arrays.asList(ignoredFiles).contains(p.getFileName().toString()))
.filter(p -> !p.toString().matches(ignore))
.forEach(p -> cr.file_results.add(analyzeFile(corpus, p, i.getAndIncrement(), cr.file_count)));
} catch (Exception e) {
String msg = "Failed while trying to iterate through and analyze " + corpus + " models.";
......
......@@ -97,7 +97,7 @@ public final class SSR extends CatalystCommand implements Runnable {
List<Path> files = Files.walk(Paths.get(modelsDir, corpus))
.filter(Files::isRegularFile)
.filter(p -> p.getFileName().toString().endsWith(".als"))
.filter(p -> !Arrays.asList(ignoredFiles).contains(p.getFileName().toString()))
.filter(p -> !p.toString().matches(ignore))
.collect(Collectors.toList());
cr.file_count = files.size();
pln("number of " + corpus + " models: " + cr.file_count);
......
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