From 9ca9bfd68778cbd059d619f734889e06b55be953 Mon Sep 17 00:00:00 2001 From: Sven van Heugten Date: Tue, 12 May 2026 16:38:47 +0200 Subject: [PATCH] Introduce --filter --- Mutannot/Program.fs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Mutannot/Program.fs b/Mutannot/Program.fs index e77c630..118570e 100644 --- a/Mutannot/Program.fs +++ b/Mutannot/Program.fs @@ -121,12 +121,14 @@ let getMutationCases projectPath = type Arguments = | [] ProjectPath of ProjectPath: string + | Filter of SearchString: string | ValidateOnly interface IArgParserTemplate with member s.Usage = match s with | ProjectPath _ -> "path/to/project.csproj|fsproj" + | Filter _ -> "filter down to mutations that contain the given search string" | ValidateOnly -> "check if the patches apply, but don't run the mutations" [] @@ -137,12 +139,18 @@ let main argv = let projectPath = parsedArguments.GetResult ProjectPath let validateOnly = parsedArguments.Contains ValidateOnly + let maybeFilter = parsedArguments.TryGetResult Filter ensureCleanWorkingDirectory () AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> restore ()) - for index, mutationCase in getMutationCases projectPath |> Seq.indexed do + let filteredMutations = + getMutationCases projectPath + |> Seq.filter _.Patch.Contains(maybeFilter |> Option.defaultValue "") + |> Seq.indexed + + for index, mutationCase in filteredMutations do Console.ForegroundColor <- ConsoleColor.Green printf $"MUTATION {index + 1}\n"