Skip to content

Commit d7ab836

Browse files
author
Illia Reva
committed
Fix HelpText.AutoBuild Usage spacing
1 parent c363001 commit d7ab836

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

src/CommandLine/Text/HelpText.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ internal static void AddLine(StringBuilder builder, string value, int maximumLen
636636
throw new ArgumentOutOfRangeException(nameof(value));
637637
}
638638

639-
value = value.Trim();
639+
value = value.TrimEnd();
640640

641641
builder.AppendWhen(builder.Length > 0, Environment.NewLine);
642642
do

tests/CommandLine.Tests/Unit/Text/HelpTextTests.cs

+18-18
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ public void Invoke_AutoBuild_for_Options_with_Usage_returns_appropriate_formatte
504504
var helpText = HelpText.AutoBuild(fakeResult);
505505

506506
// Verify outcome
507-
var text = helpText.ToString();
508-
var lines = text.ToNotEmptyLines().TrimStringArray();
507+
var text = helpText.ToString();
508+
var lines = text.ToNotEmptyLines();
509509
#if !PLATFORM_DOTNET
510510
lines[0].Should().StartWithEquivalent("CommandLine");
511511
lines[1].Should().StartWithEquivalent("Copyright (c)");
@@ -515,28 +515,28 @@ public void Invoke_AutoBuild_for_Options_with_Usage_returns_appropriate_formatte
515515
lines[1].Should().StartWithEquivalent("Copyright (C) Outercurve Foundation");
516516
#endif
517517
lines[2].ShouldBeEquivalentTo("ERROR(S):");
518-
lines[3].ShouldBeEquivalentTo("Token 'badtoken' is not recognized.");
518+
lines[3].ShouldBeEquivalentTo(" Token 'badtoken' is not recognized.");
519519
lines[4].ShouldBeEquivalentTo("USAGE:");
520520
lines[5].ShouldBeEquivalentTo("Normal scenario:");
521-
lines[6].ShouldBeEquivalentTo("mono testapp.exe --input file.bin --output out.bin");
521+
lines[6].ShouldBeEquivalentTo(" mono testapp.exe --input file.bin --output out.bin");
522522
lines[7].ShouldBeEquivalentTo("Logging warnings:");
523-
lines[8].ShouldBeEquivalentTo("mono testapp.exe -w --input file.bin");
523+
lines[8].ShouldBeEquivalentTo(" mono testapp.exe -w --input file.bin");
524524
lines[9].ShouldBeEquivalentTo("Logging errors:");
525-
lines[10].ShouldBeEquivalentTo("mono testapp.exe -e --input file.bin");
526-
lines[11].ShouldBeEquivalentTo("mono testapp.exe --errs --input=file.bin");
525+
lines[10].ShouldBeEquivalentTo(" mono testapp.exe -e --input file.bin");
526+
lines[11].ShouldBeEquivalentTo(" mono testapp.exe --errs --input=file.bin");
527527
lines[12].ShouldBeEquivalentTo("List:");
528-
lines[13].ShouldBeEquivalentTo("mono testapp.exe -l 1,2");
528+
lines[13].ShouldBeEquivalentTo(" mono testapp.exe -l 1,2");
529529
lines[14].ShouldBeEquivalentTo("Value:");
530-
lines[15].ShouldBeEquivalentTo("mono testapp.exe value");
531-
lines[16].ShouldBeEquivalentTo("-i, --input Set input file.");
532-
lines[17].ShouldBeEquivalentTo("-i, --output Set output file.");
533-
lines[18].ShouldBeEquivalentTo("--verbose Set verbosity level.");
534-
lines[19].ShouldBeEquivalentTo("-w, --warns Log warnings.");
535-
lines[20].ShouldBeEquivalentTo("-e, --errs Log errors.");
536-
lines[21].ShouldBeEquivalentTo("-l List.");
537-
lines[22].ShouldBeEquivalentTo("--help Display this help screen.");
538-
lines[23].ShouldBeEquivalentTo("--version Display version information.");
539-
lines[24].ShouldBeEquivalentTo("value pos. 0 Value.");
530+
lines[15].ShouldBeEquivalentTo(" mono testapp.exe value");
531+
lines[16].ShouldBeEquivalentTo(" -i, --input Set input file.");
532+
lines[17].ShouldBeEquivalentTo(" -i, --output Set output file.");
533+
lines[18].ShouldBeEquivalentTo(" --verbose Set verbosity level.");
534+
lines[19].ShouldBeEquivalentTo(" -w, --warns Log warnings.");
535+
lines[20].ShouldBeEquivalentTo(" -e, --errs Log errors.");
536+
lines[21].ShouldBeEquivalentTo(" -l List.");
537+
lines[22].ShouldBeEquivalentTo(" --help Display this help screen.");
538+
lines[23].ShouldBeEquivalentTo(" --version Display version information.");
539+
lines[24].ShouldBeEquivalentTo(" value pos. 0 Value.");
540540

541541
// Teardown
542542
}

0 commit comments

Comments
 (0)