Add Argu for argument parsing
This commit is contained in:
parent
ae246d3f36
commit
294b2f85a9
2 changed files with 15 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ open System.IO
|
|||
open System.Reflection
|
||||
open System.Runtime.InteropServices
|
||||
open Fli
|
||||
open Argu
|
||||
|
||||
type MutationCase = { TestName: string; Patch: string }
|
||||
|
||||
|
|
@ -118,18 +119,26 @@ let getMutationCases projectPath =
|
|||
| _ -> None))
|
||||
|> Seq.toList
|
||||
|
||||
type Arguments =
|
||||
| [<MainCommand; ExactlyOnce>] ProjectPath of ProjectPath: string
|
||||
|
||||
interface IArgParserTemplate with
|
||||
member s.Usage =
|
||||
match s with
|
||||
| ProjectPath _ -> "path/to/project.csproj|fsproj"
|
||||
|
||||
[<EntryPoint>]
|
||||
let main argv =
|
||||
if argv.Length <> 1 then
|
||||
eprintf "Usage: mutannot <path/to/project.csproj|fsproj>\n"
|
||||
exit 1
|
||||
let parsedArguments =
|
||||
ArgumentParser.Create<Arguments>(programName = "mutannot")
|
||||
|> _.ParseCommandLine(argv)
|
||||
|
||||
let projectPath = parsedArguments.GetResult ProjectPath
|
||||
|
||||
ensureCleanWorkingDirectory ()
|
||||
|
||||
AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> restore ())
|
||||
|
||||
let projectPath = argv[0]
|
||||
|
||||
for index, mutationCase in getMutationCases projectPath |> Seq.indexed do
|
||||
Console.ForegroundColor <- ConsoleColor.Green
|
||||
printf $"MUTATION {index + 1}\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue