Skip to content

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

Description

@nojaf

Since 1.1.17, running a script with -h / --help and no -p runs the default pipeline (the one with runIfOnlySpecified false) instead of printing the pipeline list. 1.1.16 prints the help.

Repro, same script under both versions:

#r "nuget: Fun.Build, 1.1.17" // works with 1.1.16

open Fun.Build

pipeline "Build" {
    stage "build" { run "echo building" }
    runIfOnlySpecified false
}

pipeline "Other" {
    stage "x" { run "echo other" }
    runIfOnlySpecified true
}

tryPrintPipelineCommandHelp ()
$ dotnet fsi build.fsx -- --help
  • 1.1.16: prints Pipelines: Build (default), Other and the usage block.
  • 1.1.17: runs the Build pipeline (echo building), then tryPrintPipelineCommandHelp prints the list afterwards.

Cause: #89 (Support run multiple pipelines in one execution) rewrote the dispatch in PipelineBuilder. Before, the isHelp check came first:

if isHelp then
    match pipelineIndex with
    | Some index when ... -> ctx.RunCommandHelp(verbose)
    | _ -> ()
else
    match pipelineIndex with
    | ...
    | None when not specified -> ctx.Run()

Now isHelp is only consulted inside the _ :: _ arm, so the no--p arm never sees it:

match pipelineIndexes with
| [] when not specified -> ctx.Run()   // runs on --help too
| [] -> ()
| _ :: _ -> ... if isHelp then ctx.RunCommandHelp(verbose) else ctx.Run()

Expected: [] when not specified && not isHelp -> ctx.Run(), so --help without -p only prints.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions