No more spurious option
This commit is contained in:
@@ -38,7 +38,7 @@ type Pipeline =
|
|||||||
| Empty
|
| Empty
|
||||||
| ShellScript of script : string * andThen : (Pipeline)
|
| ShellScript of script : string * andThen : (Pipeline)
|
||||||
| ShellScriptBind of script : string * consumeStdout : (Stdout -> Pipeline)
|
| ShellScriptBind of script : string * consumeStdout : (Stdout -> Pipeline)
|
||||||
| Sequence of first : (Pipeline * PipelineModifier option) * second : (Pipeline)
|
| Sequence of first : (Pipeline * PipelineModifier) * second : (Pipeline)
|
||||||
|
|
||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
module Pipeline =
|
module Pipeline =
|
||||||
@@ -53,14 +53,10 @@ module Pipeline =
|
|||||||
let dummyPipeline = consumeStdout (Stdout (Comp.make outputDummy))
|
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}"
|
$"%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) ->
|
| Pipeline.Sequence((first, modifier), second) ->
|
||||||
let firstMod =
|
let firstMod = $"%s{indent} %O{modifier}\n"
|
||||||
match modifier with
|
|
||||||
| None -> ""
|
|
||||||
| Some modifier ->
|
|
||||||
$"%O{modifier}"
|
|
||||||
let first = $"%s{toStringInner bindCount (indentCount + 2) first}"
|
let first = $"%s{toStringInner bindCount (indentCount + 2) first}"
|
||||||
let second = $"%s{toStringInner bindCount (indentCount + 2) second}"
|
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
|
let toString (p : Pipeline) = toStringInner 0 0 p
|
||||||
|
|
||||||
@@ -130,7 +126,7 @@ type PipelineBuilder (agent : string Comp option) =
|
|||||||
let subsequent = cont ()
|
let subsequent = cont ()
|
||||||
Pipeline.ShellScript (toRun, subsequent)
|
Pipeline.ShellScript (toRun, subsequent)
|
||||||
/// Bind in another pipeline, perhaps on a different agent
|
/// 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 ())
|
Pipeline.Sequence (p, cont ())
|
||||||
member _.Yield (x : unit) : unit = ()
|
member _.Yield (x : unit) : unit = ()
|
||||||
member _.For
|
member _.For
|
||||||
@@ -141,16 +137,17 @@ type PipelineBuilder (agent : string Comp option) =
|
|||||||
let pipeline = cont ()
|
let pipeline = cont ()
|
||||||
pipeline
|
pipeline
|
||||||
|
|
||||||
member _.Run x = x, Some modifier
|
member _.Run x =
|
||||||
|
x, modifier
|
||||||
|
|
||||||
[<AutoOpen>]
|
[<AutoOpen>]
|
||||||
module PipelineBuilder =
|
module PipelineBuilder =
|
||||||
let pipeline (agent : string Comp) = PipelineBuilder (Some agent)
|
let pipeline (agent : string Comp) = PipelineBuilder (Some agent)
|
||||||
let pipelineSameAgent = PipelineBuilder None
|
let pipelineSameAgent = PipelineBuilder None
|
||||||
let toStepDag (p : Pipeline, modifier : PipelineModifier option) : SealedStepDag<unit, unit> =
|
let toStepDag (p : Pipeline, modifier : PipelineModifier) : SealedStepDag<unit, unit> =
|
||||||
match modifier with
|
match modifier.AgentModifier with
|
||||||
| None -> failwith "Pipeline must run on an agent, but no agent was specified"
|
| 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}"
|
failwith $"TODO\n%O{modifier}\n%s{Pipeline.toString p}"
|
||||||
|
|
||||||
let foo () : SealedStepDag<unit, unit> =
|
let foo () : SealedStepDag<unit, unit> =
|
||||||
|
Reference in New Issue
Block a user