Skip to content

Commit

Permalink
Merge pull request #2 from seesharper/bugfix/help
Browse files Browse the repository at this point in the history
Don't execute default step when help is invoked
  • Loading branch information
seesharper committed Mar 26, 2019
2 parents 4aaa4ff + b2ed3f0 commit 0ebcab0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build/dotnet-steps.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>dotnet-steps</id>
<title>dotnet-steps</title>
<version>0.0.1</version>
<version>0.0.2</version>
<description>A small step for man kind, but a HUGE leap for build scripts.</description>
<authors>Bernhard Richter</authors>
<owners>Bernhard Richter</owners>
Expand Down
16 changes: 11 additions & 5 deletions src/steps.csx
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ private static class StepRunner

var stepDelegates = GetStepDelegates();

if (stepNames.Contains("help", StringComparer.OrdinalIgnoreCase))
{
ShowHelp(stepDelegates.Values.ToArray());
return;
}

if (stepDelegates.Keys.Intersect(stepNames).Count() == 0)
{
await GetDefaultDelegate(stepDelegates)();
Expand All @@ -134,11 +140,11 @@ private static class StepRunner
{
_callStack.Clear();

if (stepName.Equals("help", StringComparison.OrdinalIgnoreCase))
{
stepDelegates.Values.ToArray().ShowHelp();
continue;
}
// if (stepName.Equals("help", StringComparison.OrdinalIgnoreCase))
// {
// stepDelegates.Values.ToArray().ShowHelp();
// break;
// }

if (stepDelegates.TryGetValue(stepName, out var stepDelegate))
{
Expand Down
1 change: 1 addition & 0 deletions src/steps.tests.csx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public async Task ShouldShowHelp()
TestContext.StandardOut.Should().Contain("Available Steps");
TestContext.StandardOut.Should().Contain("This is step one");
TestContext.StandardOut.Should().Contain("step1 (default)");
TestContext.StandardOut.Should().NotContain("Steps Summary");
}

public async Task ShouldReportNestedStep()
Expand Down

0 comments on commit 0ebcab0

Please sign in to comment.