Skip to content

Commit

Permalink
Merge pull request #53 from nunit/issue-46
Browse files Browse the repository at this point in the history
Fix error when target is invalid
  • Loading branch information
CharliePoole authored Dec 26, 2024
2 parents b89378b + 185abc7 commit 2dcb530
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions recipe/builder.cake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
// EXECUTION
//////////////////////////////////////////////////////////////////////

public Builder Build => CommandLineOptions.Usage
? new Builder(() => Information(HelpMessages.Usage))
: new Builder(() => RunTargets(CommandLineOptions.Targets.Values));
public Builder Build
{
get
{
if (CommandLineOptions.Usage)
return new Builder(() => Information(HelpMessages.Usage));

if (CommandLineOptions.Targets.Values.Count() == 1)
return new Builder(() => RunTarget(CommandLineOptions.Target.Value));

return new Builder(() => RunTargets(CommandLineOptions.Targets.Values));
}
}

CakeReport RunTargets(ICollection<string> targets)
=> RunTarget(GetOrAddTargetsTask(targets).Name);
Expand Down

0 comments on commit 2dcb530

Please sign in to comment.