Introduce --filter
This commit is contained in:
parent
de5843a783
commit
9ca9bfd687
1 changed files with 9 additions and 1 deletions
|
|
@ -121,12 +121,14 @@ let getMutationCases projectPath =
|
||||||
|
|
||||||
type Arguments =
|
type Arguments =
|
||||||
| [<MainCommand; ExactlyOnce>] ProjectPath of ProjectPath: string
|
| [<MainCommand; ExactlyOnce>] ProjectPath of ProjectPath: string
|
||||||
|
| Filter of SearchString: string
|
||||||
| ValidateOnly
|
| ValidateOnly
|
||||||
|
|
||||||
interface IArgParserTemplate with
|
interface IArgParserTemplate with
|
||||||
member s.Usage =
|
member s.Usage =
|
||||||
match s with
|
match s with
|
||||||
| ProjectPath _ -> "path/to/project.csproj|fsproj"
|
| 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"
|
| ValidateOnly -> "check if the patches apply, but don't run the mutations"
|
||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
|
|
@ -137,12 +139,18 @@ let main argv =
|
||||||
|
|
||||||
let projectPath = parsedArguments.GetResult ProjectPath
|
let projectPath = parsedArguments.GetResult ProjectPath
|
||||||
let validateOnly = parsedArguments.Contains ValidateOnly
|
let validateOnly = parsedArguments.Contains ValidateOnly
|
||||||
|
let maybeFilter = parsedArguments.TryGetResult Filter
|
||||||
|
|
||||||
ensureCleanWorkingDirectory ()
|
ensureCleanWorkingDirectory ()
|
||||||
|
|
||||||
AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> restore ())
|
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
|
Console.ForegroundColor <- ConsoleColor.Green
|
||||||
printf $"MUTATION {index + 1}\n"
|
printf $"MUTATION {index + 1}\n"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue