Skip to content

Instantly share code, notes, and snippets.

@SteveGilham
Created November 16, 2022 12:30
Show Gist options
  • Save SteveGilham/c293562b670ad5d705b4efb7bc1aee2d to your computer and use it in GitHub Desktop.
Save SteveGilham/c293562b670ad5d705b4efb7bc1aee2d to your computer and use it in GitHub Desktop.
let paramsToEnvironment (o: DotNet.Options) =
o.CustomParams
|> Option.map (fun x -> let bits = x.Split ("/p:", StringSplitOptions.RemoveEmptyEntries)
bits
|> Array.fold (fun (o2: DotNet.Options) flag -> let line = flag.TrimEnd([| ' '; '"' |])
let split = if line.Contains "=\""
then "=\""
else "="
let parts = line.Split (split, StringSplitOptions.RemoveEmptyEntries)
{ o2 with Environment = o2.Environment |> Map.add parts[0] parts[1] }) o)
|> Option.defaultValue o
let testWithEnvironment (o: Fake.DotNet.DotNet.TestOptions) =
{o with Common = {paramsToEnvironment o.Common with CustomParams = None }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment