-printfn "Enter a directory"
-let directory = Console.ReadLine()
match Directory.Exists directory with
| true -> Directory.GetFiles(directory) |> Option.Some
let content = reader.ReadToEnd()
content.ToCharArray() |> Array.fold (fun state item -> if item='\n' then state + 1 else state + 0) 0
-let printReport getFiles =
+let printReport directory =
+ match directory |> getFiles with
| None -> printfn "Couldn't get any files from the directory."
let lineCounts = files |> Array.map (fun x -> countLines x)
- Array.iter2 (fun x y -> printfn "File: %s - %i lines" x y) files lineCounts
+ Array.iter2 (fun x y -> printfn "File: %s - %i lines" x y) files lineCounts
+printfn "Enter a directory"
+Console.ReadLine() |> printReport