From d3ecf50203f29823f48ef7b7cafba950393fb1e3 Mon Sep 17 00:00:00 2001 From: "John J. Aylward" Date: Wed, 17 Jun 2020 23:59:32 -0400 Subject: [PATCH] fix spacing on help messages when verbs have aliases --- src/CommandLine/Text/HelpText.cs | 4 ++-- tests/CommandLine.Tests/Unit/Issue6Tests.cs | 24 ++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/CommandLine/Text/HelpText.cs b/src/CommandLine/Text/HelpText.cs index 3894bc9d..f5e9a7b9 100644 --- a/src/CommandLine/Text/HelpText.cs +++ b/src/CommandLine/Text/HelpText.cs @@ -851,8 +851,8 @@ private IEnumerable AdaptVerbsToSpecifications(IEnumerable var optionSpecs = from verbTuple in Verb.SelectFromTypes(types) select OptionSpecification.NewSwitch( - verbTuple.Item1.Name, - verbTuple.Item1.Aliases.ToDelimitedString(", "), + string.Empty, + verbTuple.Item1.Name.Concat(verbTuple.Item1.Aliases).ToDelimitedString(", "), false, verbTuple.Item1.IsDefault ? "(Default Verb) " + verbTuple.Item1.HelpText : verbTuple.Item1.HelpText, //Default verb string.Empty, diff --git a/tests/CommandLine.Tests/Unit/Issue6Tests.cs b/tests/CommandLine.Tests/Unit/Issue6Tests.cs index 224ba41a..2f6ea3f4 100644 --- a/tests/CommandLine.Tests/Unit/Issue6Tests.cs +++ b/tests/CommandLine.Tests/Unit/Issue6Tests.cs @@ -89,17 +89,17 @@ public void Parse_option_with_aliased_verb(string args, Type expectedArgType) { "copy, cp, cpy (Default Verb) Copy some stuff", "move, mv", - "delete Delete stuff", - "help Display more information on a specific command.", - "version Display version information.", + "delete Delete stuff", + "help Display more information on a specific command.", + "version Display version information.", })] [InlineData("help", true, new string[] { "copy, cp, cpy (Default Verb) Copy some stuff", "move, mv", - "delete Delete stuff", - "help Display more information on a specific command.", - "version Display version information.", + "delete Delete stuff", + "help Display more information on a specific command.", + "version Display version information.", })] [InlineData("move --help", false, new string[] { @@ -163,16 +163,16 @@ public void Parse_help_option_for_aliased_verbs(string args, bool verbsIndex, st [InlineData("--help", true, new string[] { "move, mv", - "delete Delete stuff", - "help Display more information on a specific command.", - "version Display version information.", + "delete Delete stuff", + "help Display more information on a specific command.", + "version Display version information.", })] [InlineData("help", true, new string[] { "move, mv", - "delete Delete stuff", - "help Display more information on a specific command.", - "version Display version information.", + "delete Delete stuff", + "help Display more information on a specific command.", + "version Display version information.", })] [InlineData("move --help", false, new string[] {