FSharp.Text.Docker icon indicating copy to clipboard operation
FSharp.Text.Docker copied to clipboard

support iteration to generate steps from sequence

Open joprice opened this issue 6 months ago • 0 comments

It would be convenient to be able to iterate over a sequence to generate commands, for example

for src, dest in [ "file-1", "b"; "file-2", "b" ] do
                  yield! dockerfile { copy src dest }

Not sure if there's a more ideal way to express that, but this seems to work with this implementation in the builder:

 member this.For(items, f) : DockerfileSpec =
              let mutable result = { Instructions = [] }
              for item in items do
                  result <- this.Combine(result, f item)
              result

joprice avatar Aug 12 '24 18:08 joprice