From 98e938bcecfd6781948ddca4c1d78b3b13d57f1e Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Tue, 22 Aug 2023 18:59:00 +0800 Subject: [PATCH] Fsdk/Misc.fs: make recently added test pass --- Fsdk/Misc.fs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Fsdk/Misc.fs b/Fsdk/Misc.fs index 36a4d7d..73ff661 100644 --- a/Fsdk/Misc.fs +++ b/Fsdk/Misc.fs @@ -98,8 +98,20 @@ module Misc = | OnlyFlags of seq | BothFlags of seq*string*seq - let ParseArgs (_args: array): ArgsParsed = - failwith "NIE" + let ParseArgs (args: array): ArgsParsed = + let rec innerFunc (theArgs: List) currentCount = + match theArgs with + | [] -> currentCount + | head::tail -> + if head.StartsWith "--" || head.StartsWith "-" then + innerFunc tail (currentCount + 1) + else + currentCount + + let revArgs = Array.rev args |> List.ofArray + let count = innerFunc revArgs 0 + let dummyList = [ for _dummyItem in 0 .. (count - 1) -> String.Empty ] |> Seq.ofList + ArgsParsed.OnlyFlags dummyList let FsxOnlyArguments() = let cmdLineArgs = Environment.GetCommandLineArgs() |> List.ofSeq