From 9a79297e36630f6d387681676b3a75d1bf171945 Mon Sep 17 00:00:00 2001 From: Smaug123 Date: Thu, 21 Dec 2023 22:41:38 +0000 Subject: [PATCH] No more spurious option --- WoofWorkflows/Pipeline.fs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/WoofWorkflows/Pipeline.fs b/WoofWorkflows/Pipeline.fs index f47641f..e0826c9 100644 --- a/WoofWorkflows/Pipeline.fs +++ b/WoofWorkflows/Pipeline.fs @@ -38,7 +38,7 @@ type Pipeline = | Empty | ShellScript of script : string * andThen : (Pipeline) | ShellScriptBind of script : string * consumeStdout : (Stdout -> Pipeline) - | Sequence of first : (Pipeline * PipelineModifier option) * second : (Pipeline) + | Sequence of first : (Pipeline * PipelineModifier) * second : (Pipeline) [] module Pipeline = @@ -53,14 +53,10 @@ module Pipeline = let dummyPipeline = consumeStdout (Stdout (Comp.make outputDummy)) $"%s{indent}Run: %s{script}\n%s{indent}With its output labelled %s{outputDummy}:\n%s{toStringInner (bindCount + 1) (indentCount + 2) dummyPipeline}" | Pipeline.Sequence((first, modifier), second) -> - let firstMod = - match modifier with - | None -> "" - | Some modifier -> - $"%O{modifier}" + let firstMod = $"%s{indent} %O{modifier}\n" let first = $"%s{toStringInner bindCount (indentCount + 2) first}" let second = $"%s{toStringInner bindCount (indentCount + 2) second}" - $"%s{indent} {firstMod}\n%s{first}\n%s{indent}----\n%s{second}" + $"%s{firstMod}%s{first}\n%s{indent}----\n%s{second}" let toString (p : Pipeline) = toStringInner 0 0 p @@ -130,7 +126,7 @@ type PipelineBuilder (agent : string Comp option) = let subsequent = cont () Pipeline.ShellScript (toRun, subsequent) /// Bind in another pipeline, perhaps on a different agent - member _.Bind (p : Pipeline * PipelineModifier option, cont : unit -> Pipeline) : Pipeline = + member _.Bind (p : Pipeline * PipelineModifier, cont : unit -> Pipeline) : Pipeline = Pipeline.Sequence (p, cont ()) member _.Yield (x : unit) : unit = () member _.For @@ -141,16 +137,17 @@ type PipelineBuilder (agent : string Comp option) = let pipeline = cont () pipeline - member _.Run x = x, Some modifier + member _.Run x = + x, modifier [] module PipelineBuilder = let pipeline (agent : string Comp) = PipelineBuilder (Some agent) let pipelineSameAgent = PipelineBuilder None - let toStepDag (p : Pipeline, modifier : PipelineModifier option) : SealedStepDag = - match modifier with + let toStepDag (p : Pipeline, modifier : PipelineModifier) : SealedStepDag = + match modifier.AgentModifier with | None -> failwith "Pipeline must run on an agent, but no agent was specified" - | Some modifier -> + | Some _ -> failwith $"TODO\n%O{modifier}\n%s{Pipeline.toString p}" let foo () : SealedStepDag =