Skip to content

Commit 36f8853

Browse files
authored
Merge pull request #137 from kristiker/helptext-commas
Fix commas being stripped from helptext
2 parents 4e2e44b + 5a5cd09 commit 36f8853

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ConsoleAppFramework/Parser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,13 @@ void ParseParameterDescription(string originalDescription, out string[] aliases,
591591
// Example:
592592
// -h|--help, This is a help.
593593

594-
var splitOne = originalDescription.Split(',');
594+
var splitOne = originalDescription.Split(',', 2);
595595

596596
// has alias
597597
if (splitOne[0].TrimStart().StartsWith("-"))
598598
{
599599
aliases = splitOne[0].Split(['|'], StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim()).ToArray();
600-
description = string.Join("", splitOne.Skip(1)).Trim();
600+
description = splitOne.Length > 1 ? splitOne[1].Trim() : string.Empty;
601601
}
602602
else
603603
{

tests/ConsoleAppFramework.GeneratorTests/HelpTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public class MyClass
285285
/// hello my world.
286286
/// </summary>
287287
/// <param name="boo">-b, my boo is not boo.</param>
288-
/// <param name="fooBar">-f|-fb, my foo is not bar.</param>
288+
/// <param name="fooBar">-f|-fb, my foo, is not bar.</param>
289289
public void HelloWorld([Argument]int boo, string fooBar)
290290
{
291291
Console.Write("Hello World! " + fooBar);
@@ -301,7 +301,7 @@ hello my world.
301301
[0] <int> my boo is not boo.
302302
303303
Options:
304-
-f|-fb|--foo-bar <string> my foo is not bar. (Required)
304+
-f|-fb|--foo-bar <string> my foo, is not bar. (Required)
305305
306306
""");
307307
}

0 commit comments

Comments
 (0)