nuke icon indicating copy to clipboard operation
nuke copied to clipboard

OnlyWhenX: add skip reason

Open ITaluone opened this issue 2 years ago • 2 comments

Description

If a step is skipped due to a skipping reason, the SkipReason in the command line output is semantically wrong. But when configuring the build target it is semantically correct.

Example:

Target PushStable => _ => _
        .DependsOn(Pack)
        .OnlyWhenDynamic(() => IsNoPrerelease)
        .Executes(() => {});

Output: PushStable               Skipped                // SkipReason: IsNoPrerelease <--- this should be called IsPrerelease (because of that reason this is skipped)

Usage Example

Target PushStable => _ => _
        .DependsOn(Pack)
        .OnlyWhenDynamic("Because it is a prerelease", () => IsNoPrerelease)
        .Executes(() => {});

Output:
PushStable               Skipped                // SkipReason: Because it is a prerelease

Alternative

No response

ITaluone avatar May 12 '22 05:05 ITaluone

An alternative would be to add a new method: SkipWhen which does the opposite of OnlyWhen.

IT-VBFK avatar May 15 '22 18:05 IT-VBFK

I just had the same confusion reading the output.

My inital feeling was we could just rename "SkipReason: " to "OnlyIf:", or "OnlyWhen:"

That way at least the sense (and semantics) of the message would be correct.

PushStable               Skipped                // OnlyIf: IsNoPrerelease

MartinSGill avatar Jul 19 '22 15:07 MartinSGill

Thanks :) Looking forward to 6.3.0 🎉🎉

ITaluone avatar Dec 14 '22 13:12 ITaluone