Skip to content

Commit

Permalink
#27 In command help message, line should be aligned bug
Browse files Browse the repository at this point in the history
  • Loading branch information
BigEgg committed Feb 19, 2017
1 parent b45f372 commit 319170f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ private string BuildCommandHelpRequestText(IEnumerable<Error> errors, int maximu
(pa.Required ? "" : "]");
}));
var propertyInfos = error.PropertyAttributes
.Select(pa => new Tuple<string, string>(
$"--{pa.LongName} | --{pa.ShortName}",
.Select(pa => new Tuple<string, string, string>(
$"--{pa.LongName}",
$"--{pa.ShortName}",
pa.HelpMessage));
int propertyNameLenght = (int)(Math.Ceiling(propertyInfos.Max(message => message.Item1.Length) / ParameterConstants.TAB_LENGTH) * ParameterConstants.TAB_LENGTH);
var propertyHelpMessages = propertyInfos.Select(message => $" {message.Item1.FillWithCharacter(propertyNameLenght, ' ')} {ParameterConstants.INDEX_START_STRING}{message.Item2}");
int longNameLenght = (int)(Math.Ceiling(propertyInfos.Max(message => message.Item1.Length) / ParameterConstants.TAB_LENGTH) * ParameterConstants.TAB_LENGTH);
int shortNameLenght = (int)(Math.Ceiling(propertyInfos.Max(message => message.Item1.Length) / ParameterConstants.TAB_LENGTH) * ParameterConstants.TAB_LENGTH);
var propertyHelpMessages = propertyInfos.Select(
message => $" {message.Item1.FillWithCharacter(longNameLenght, ' ')} | {message.Item2.FillWithCharacter(shortNameLenght, ' ')} {ParameterConstants.INDEX_START_STRING}{message.Item3}");

return BuildString(new List<string>()
{
Expand Down

0 comments on commit 319170f

Please sign in to comment.