@@ -20,11 +20,11 @@ public class HelpBuilder : IHelpBuilder
20
20
21
21
protected IConsole Console { get ; }
22
22
23
- public int ColumnGutter { get ; }
23
+ public int ColumnGutter { get ; }
24
24
25
- public int IndentationSize { get ; }
25
+ public int IndentationSize { get ; }
26
26
27
- public int MaxWidth { get ; }
27
+ public int MaxWidth { get ; }
28
28
29
29
/// <summary>
30
30
/// Brokers the generation and output of help text of <see cref="Symbol"/>
@@ -215,10 +215,11 @@ protected void AppendHelpItem(HelpItem helpItem, int maxInvocationWidth)
215
215
var offset = maxInvocationWidth + ColumnGutter - helpItem . Invocation . Length ;
216
216
var availableWidth = GetAvailableWidth ( ) ;
217
217
var maxDescriptionWidth = availableWidth - maxInvocationWidth - ColumnGutter ;
218
- var descriptionColumn = helpItem . Description ;
218
+ var postfix = string . IsNullOrEmpty ( helpItem . Description ) ? string . Empty : " " ;
219
+ var descriptionColumn = helpItem . Description + postfix ;
219
220
if ( helpItem . HasDefaultValueHint )
220
221
{
221
- descriptionColumn += " " + helpItem . DefaultValueHint ;
222
+ descriptionColumn += helpItem . DefaultValueHint ;
222
223
}
223
224
var descriptionLines = SplitText ( descriptionColumn , maxDescriptionWidth ) ;
224
225
var lineCount = descriptionLines . Count ;
@@ -257,7 +258,7 @@ protected virtual IReadOnlyCollection<string> SplitText(string text, int maxLeng
257
258
258
259
if ( string . IsNullOrWhiteSpace ( cleanText ) || textLength < maxLength )
259
260
{
260
- return new [ ] { cleanText } ;
261
+ return new [ ] { cleanText } ;
261
262
}
262
263
263
264
var lines = new List < string > ( ) ;
@@ -298,7 +299,7 @@ private IEnumerable<HelpItem> GetArgumentHelpItems(ISymbol symbol)
298
299
{
299
300
foreach ( var argument in symbol . Arguments ( ) )
300
301
{
301
- if ( ShouldShowHelp ( argument ) )
302
+ if ( ShouldShowHelp ( argument ) )
302
303
{
303
304
var argumentDescriptor = ArgumentDescriptor ( argument ) ;
304
305
@@ -323,7 +324,7 @@ private IEnumerable<HelpItem> GetArgumentHelpItems(ISymbol symbol)
323
324
324
325
protected virtual string ArgumentDescriptor ( IArgument argument )
325
326
{
326
- if ( argument . ValueType == typeof ( bool ) || argument . ValueType == typeof ( bool ? ) )
327
+ if ( argument . ValueType == typeof ( bool ) || argument . ValueType == typeof ( bool ? ) )
327
328
{
328
329
return "" ;
329
330
}
@@ -459,7 +460,7 @@ protected virtual void AddUsage(ICommand command)
459
460
{
460
461
usage . Add ( Usage . Options ) ;
461
462
}
462
-
463
+
463
464
usage . Add ( FormatArgumentUsage ( command . Arguments . ToArray ( ) ) ) ;
464
465
465
466
var hasCommandHelp = command . Children
@@ -609,14 +610,14 @@ private bool ShouldDisplayArgumentHelp(ICommand? command)
609
610
610
611
private int GetConsoleWindowWidth ( )
611
612
{
612
- try
613
+ try
613
614
{
614
615
return System . Console . WindowWidth ;
615
616
}
616
617
catch ( System . IO . IOException )
617
618
{
618
619
return int . MaxValue ;
619
- }
620
+ }
620
621
}
621
622
622
623
protected class HelpItem
@@ -640,7 +641,7 @@ public HelpItem(
640
641
protected bool Equals ( HelpItem other ) =>
641
642
( Invocation , Description ) == ( other . Invocation , other . Description ) ;
642
643
643
- public override bool Equals ( object obj ) => Equals ( ( HelpItem ) obj ) ;
644
+ public override bool Equals ( object obj ) => Equals ( ( HelpItem ) obj ) ;
644
645
645
646
public override int GetHashCode ( ) => ( Invocation , Description ) . GetHashCode ( ) ;
646
647
0 commit comments