Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't execute default step when help is invoked #2

Merged
merged 1 commit into from
Mar 26, 2019
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
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