@@ -161,7 +161,7 @@ static string BuildOptionsMessage(CommandHelpDefinition definition)
161161 var optionsFormatted = definition . Options
162162 . Where ( x => ! x . Index . HasValue )
163163 . Where ( x => ! x . IsHidden )
164- . Select ( x => ( Options : string . Join ( "|" , x . Options ) + ( x . IsFlag ? string . Empty : $ " { x . FormattedValueTypeName } { ( x . IsParams ? "..." : "" ) } ") , x . Description , x . IsRequired , x . IsFlag , x . DefaultValue ) )
164+ . Select ( x => ( Options : string . Join ( "|" , x . Options ) + ( x . IsFlag ? string . Empty : $ " { x . FormattedValueTypeName } { ( x . IsParams ? "..." : "" ) } ") , x . Description , x . IsRequired , x . IsFlag , x . DefaultValue , x . IsDefaultValueHidden ) )
165165 . ToArray ( ) ;
166166
167167 if ( ! optionsFormatted . Any ( ) ) return string . Empty ;
@@ -202,7 +202,8 @@ static string BuildOptionsMessage(CommandHelpDefinition definition)
202202 }
203203 else if ( opt . DefaultValue != null )
204204 {
205- sb . Append ( $ " (Default: { opt . DefaultValue } )") ;
205+ if ( ! opt . IsDefaultValueHidden )
206+ sb . Append ( $ " (Default: { opt . DefaultValue } )") ;
206207 }
207208 else if ( opt . IsRequired )
208209 {
@@ -285,6 +286,7 @@ static CommandHelpDefinition CreateCommandHelpDefinition(Command descriptor)
285286 var isFlag = item . Type . SpecialType == Microsoft . CodeAnalysis . SpecialType . System_Boolean ;
286287 var isParams = item . IsParams ;
287288 var isHidden = item . IsHidden ;
289+ var isDefaultValueHidden = item . IsDefaultValueHidden ;
288290
289291 var defaultValue = default ( string ) ;
290292 if ( item . HasDefaultValue )
@@ -306,7 +308,7 @@ static CommandHelpDefinition CreateCommandHelpDefinition(Command descriptor)
306308 }
307309
308310 var paramTypeName = item . ToTypeShortString ( ) ;
309- parameterDefinitions . Add ( new CommandOptionHelpDefinition ( options . Distinct ( ) . ToArray ( ) , description , paramTypeName , defaultValue , index , isFlag , isParams , isHidden ) ) ;
311+ parameterDefinitions . Add ( new CommandOptionHelpDefinition ( options . Distinct ( ) . ToArray ( ) , description , paramTypeName , defaultValue , index , isFlag , isParams , isHidden , isDefaultValueHidden ) ) ;
310312 }
311313
312314 var commandName = descriptor . Name ;
@@ -342,9 +344,10 @@ class CommandOptionHelpDefinition
342344 public bool IsFlag { get ; }
343345 public bool IsParams { get ; }
344346 public bool IsHidden { get ; }
347+ public bool IsDefaultValueHidden { get ; }
345348 public string FormattedValueTypeName => "<" + ValueTypeName + ">" ;
346349
347- public CommandOptionHelpDefinition ( string [ ] options , string description , string valueTypeName , string ? defaultValue , int ? index , bool isFlag , bool isParams , bool isHidden )
350+ public CommandOptionHelpDefinition ( string [ ] options , string description , string valueTypeName , string ? defaultValue , int ? index , bool isFlag , bool isParams , bool isHidden , bool isDefaultValueHidden )
348351 {
349352 Options = options ;
350353 Description = description ;
@@ -354,6 +357,7 @@ public CommandOptionHelpDefinition(string[] options, string description, string
354357 IsFlag = isFlag ;
355358 IsParams = isParams ;
356359 IsHidden = isHidden ;
360+ IsDefaultValueHidden = isDefaultValueHidden ;
357361 }
358362 }
359363}
0 commit comments