Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Fun.Build.Tests/PipelineBuilderTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -572,3 +572,46 @@ let ``check GetAllCmdArgs and RemainingArgs works when remaining args is not pro

Assert.Equal<string list>([ "-p"; "demo"; "test1"; "v1" ], actualAllCmdArgs)
Assert.Equal<string list>([], actualRemainingArgs)

[<Fact>]
let ``help without -p should not run default pipeline`` () =
let mutable called = false

pipeline "Build" {
cmdArgs [ "--help" ]
stage "build" { run (fun _ -> called <- true) }
runIfOnlySpecified false
}

Assert.False(called)

[<Fact>]
let ``help with -p should not run pipeline`` () =
let mutable called = false

pipeline "Build" {
cmdArgs [ "-p"; "Build"; "--help" ]
stage "build" { run (fun _ -> called <- true) }
runIfOnlySpecified
}

Assert.False(called)

[<Fact>]
let ``help without -p should not run any pipeline when multiple exist`` () =
let mutable buildCalled = false
let mutable otherCalled = false

pipeline "Build" {
cmdArgs [ "--help" ]
stage "build" { run (fun _ -> buildCalled <- true) }
runIfOnlySpecified false
}
pipeline "Other" {
cmdArgs [ "--help" ]
stage "other" { run (fun _ -> otherCalled <- true) }
runIfOnlySpecified true
}

Assert.False(buildCalled)
Assert.False(otherCalled)
5 changes: 5 additions & 0 deletions Fun.Build/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

## [1.1.18] - 2026-08-31

- Fix: help without -p runs the default pipeline instead of printing help
#91

## [1.1.17] - 2025-09-23

Support run multiple pipelines in one execution
Expand Down
2 changes: 1 addition & 1 deletion Fun.Build/PipelineBuilder.fs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ type PipelineBuilder(name: string) =

try
match pipelineIndexes with
| [] when not specified -> ctx.Run()
| [] when not specified && not isHelp -> ctx.Run()
| [] -> ()
| _ :: _ ->
for i, index in Seq.indexed pipelineIndexes do
Expand Down
9 changes: 5 additions & 4 deletions demo-cmd.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ module Apps =

let all = [ app1; app2; app3 ]

let args =
{| app = fun apps -> CmdArg.Create(shortName = "-a", longName = "--app", values = apps, description = "specify the app you want to dev")
path = CmdArg.Create("-f", "--file", "publish directory for the app")
watch = CmdArg.Create(shortName = "-w", description = "if is in watch mode") |}
let args = {|
app = fun apps -> CmdArg.Create(shortName = "-a", longName = "--app", values = apps, description = "specify the app you want to dev")
path = CmdArg.Create("-f", "--file", "publish directory for the app")
watch = CmdArg.Create(shortName = "-w", description = "if is in watch mode")
|}


pipeline "demo" {
Expand Down
Loading