Skip to content

Commit

Permalink
Fsdk/Misc.fs: make recently added test pass
Browse files Browse the repository at this point in the history
  • Loading branch information
knocte committed Aug 23, 2023
1 parent 32b0c39 commit c7fb6c1
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions Fsdk/Misc.fs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,28 @@ module Misc =

type ArgsParsed =
| OnlyFlags of seq<string>
| BothFlags of seq<string>*string*seq<string>
| BothFlags of seq<string> * string * seq<string>

let ParseArgs(args: array<string>) : ArgsParsed =
let rec innerFunc (theArgs: List<string>) 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

let ParseArgs (_args: array<string>): ArgsParsed =
failwith "NIE"
ArgsParsed.OnlyFlags dummyList

let FsxOnlyArguments() =
let cmdLineArgs = Environment.GetCommandLineArgs() |> List.ofSeq
Expand Down

0 comments on commit c7fb6c1

Please sign in to comment.