Skip to content

Fix HelpText.AutoBuild Usage spacing #280

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

Merged
merged 1 commit into from
Aug 13, 2018
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 src/CommandLine/Text/HelpText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ internal static void AddLine(StringBuilder builder, string value, int maximumLen
throw new ArgumentOutOfRangeException(nameof(value));
}

value = value.Trim();
value = value.TrimEnd();

builder.AppendWhen(builder.Length > 0, Environment.NewLine);
do
Expand Down
36 changes: 18 additions & 18 deletions tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ public void Invoke_AutoBuild_for_Options_with_Usage_returns_appropriate_formatte
var helpText = HelpText.AutoBuild(fakeResult);

// Verify outcome
var text = helpText.ToString();
var lines = text.ToNotEmptyLines().TrimStringArray();
var text = helpText.ToString();
var lines = text.ToNotEmptyLines();
#if !PLATFORM_DOTNET
lines[0].Should().StartWithEquivalent("CommandLine");
lines[1].Should().StartWithEquivalent("Copyright (c)");
Expand All @@ -515,28 +515,28 @@ public void Invoke_AutoBuild_for_Options_with_Usage_returns_appropriate_formatte
lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation");
#endif
lines[2].ShouldBeEquivalentTo("ERROR(S):");
lines[3].ShouldBeEquivalentTo("Token 'badtoken' is not recognized.");
lines[3].ShouldBeEquivalentTo(" Token 'badtoken' is not recognized.");
lines[4].ShouldBeEquivalentTo("USAGE:");
lines[5].ShouldBeEquivalentTo("Normal scenario:");
lines[6].ShouldBeEquivalentTo("mono testapp.exe --input file.bin --output out.bin");
lines[6].ShouldBeEquivalentTo(" mono testapp.exe --input file.bin --output out.bin");
lines[7].ShouldBeEquivalentTo("Logging warnings:");
lines[8].ShouldBeEquivalentTo("mono testapp.exe -w --input file.bin");
lines[8].ShouldBeEquivalentTo(" mono testapp.exe -w --input file.bin");
lines[9].ShouldBeEquivalentTo("Logging errors:");
lines[10].ShouldBeEquivalentTo("mono testapp.exe -e --input file.bin");
lines[11].ShouldBeEquivalentTo("mono testapp.exe --errs --input=file.bin");
lines[10].ShouldBeEquivalentTo(" mono testapp.exe -e --input file.bin");
lines[11].ShouldBeEquivalentTo(" mono testapp.exe --errs --input=file.bin");
lines[12].ShouldBeEquivalentTo("List:");
lines[13].ShouldBeEquivalentTo("mono testapp.exe -l 1,2");
lines[13].ShouldBeEquivalentTo(" mono testapp.exe -l 1,2");
lines[14].ShouldBeEquivalentTo("Value:");
lines[15].ShouldBeEquivalentTo("mono testapp.exe value");
lines[16].ShouldBeEquivalentTo("-i, --input Set input file.");
lines[17].ShouldBeEquivalentTo("-i, --output Set output file.");
lines[18].ShouldBeEquivalentTo("--verbose Set verbosity level.");
lines[19].ShouldBeEquivalentTo("-w, --warns Log warnings.");
lines[20].ShouldBeEquivalentTo("-e, --errs Log errors.");
lines[21].ShouldBeEquivalentTo("-l List.");
lines[22].ShouldBeEquivalentTo("--help Display this help screen.");
lines[23].ShouldBeEquivalentTo("--version Display version information.");
lines[24].ShouldBeEquivalentTo("value pos. 0 Value.");
lines[15].ShouldBeEquivalentTo(" mono testapp.exe value");
lines[16].ShouldBeEquivalentTo(" -i, --input Set input file.");
lines[17].ShouldBeEquivalentTo(" -i, --output Set output file.");
lines[18].ShouldBeEquivalentTo(" --verbose Set verbosity level.");
lines[19].ShouldBeEquivalentTo(" -w, --warns Log warnings.");
lines[20].ShouldBeEquivalentTo(" -e, --errs Log errors.");
lines[21].ShouldBeEquivalentTo(" -l List.");
lines[22].ShouldBeEquivalentTo(" --help Display this help screen.");
lines[23].ShouldBeEquivalentTo(" --version Display version information.");
lines[24].ShouldBeEquivalentTo(" value pos. 0 Value.");

// Teardown
}
Expand Down