1
module ParasitemiaUI.Args
10 | CmdLine of Input * string // A file or a directory to process and the output directory.
11 | Window of string option // An optional path to a file to open can be given in window mode.
13 type Arguments = RunningMode * bool // bool : true if in debug mode.
15 let parse (args
: string[]) : Arguments =
17 let output = Array.tryFindIndex
((=) "--output") args
20 match Array.tryFindIndex
((=) "--folder") args
, output with
21 | Some i
, Some i_output when i
< args
.Length - 2 && i_output < args
.Length - 2 ->
22 CmdLine ((Dir args
.[i
+ 1]), args
.[i_output + 1])
24 match Array.tryFindIndex
((=) "--file") args
, output with
25 | Some i
, Some i_output when i
< args
.Length - 2 && i_output < args
.Length - 2 ->
26 CmdLine ((File args.[i
+ 1]), args.[i_output + 1])
28 Window (if args.Length > 0 && not
(args.[0].StartsWith ("--")) then Some args.[0] else None)
30 runningMode, Array.exists
((=) "--debug") args
33 Console.WriteLine Utils.argsHelp