@@ -7,7 +7,7 @@ import { isHydratedCommandMetadata } from '../guards';
7
7
import { filter , map } from '../utils/array' ;
8
8
import { generateFillSpaceStringList , stringWidth , wordWrap } from '../utils/format' ;
9
9
10
- import { Colors , DEFAULT_COLORS } from './colors' ;
10
+ import { ColorFunction , Colors , DEFAULT_COLORS } from './colors' ;
11
11
import { formatOptionName , hydrateOptionSpec } from './options' ;
12
12
import { validators } from './validators' ;
13
13
@@ -224,14 +224,18 @@ export class NamespaceStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N e
224
224
const fillStringArray = generateFillSpaceStringList ( fullCmd , this . dotswidth , weak ( '.' ) ) ;
225
225
226
226
const formattedCommands = await Promise . all ( commands . map ( async ( cmd , index ) => {
227
+ const wrapColor : ColorFunction = cmd . groups && cmd . groups . includes ( CommandGroup . Deprecated ) ? weak : lodash . identity ;
228
+
227
229
const summary = (
228
230
( await this . formatBeforeCommandSummary ( cmd ) ) +
229
231
cmd . summary +
230
232
( await this . formatAfterCommandSummary ( cmd ) )
231
233
) ;
232
234
233
235
const wrappedSummary = wordWrap ( summary , { indentation : this . dotswidth + 6 } ) ;
234
- return `${ input ( lodash . tail ( cmd . path ) . map ( ( [ p ] ) => p ) . join ( ' ' ) ) } ${ wrappedSummary ? ' ' + fillStringArray [ index ] + ' ' + wrappedSummary : '' } ` ;
236
+ const line = `${ input ( lodash . tail ( cmd . path ) . map ( ( [ p ] ) => p ) . join ( ' ' ) ) } ${ wrappedSummary ? ' ' + fillStringArray [ index ] + ' ' + wrappedSummary : '' } ` ;
237
+
238
+ return wrapColor ( line ) ;
235
239
} ) ) ;
236
240
237
241
return formattedCommands ;
@@ -481,6 +485,7 @@ export class CommandStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N ext
481
485
482
486
async formatOptionLine ( opt : O ) {
483
487
const { weak } = this . colors ;
488
+ const wrapColor : ColorFunction = opt . groups && opt . groups . includes ( OptionGroup . Deprecated ) ? weak : lodash . identity ;
484
489
const optionName = formatOptionName ( opt , { colors : this . colors } ) ;
485
490
const optionNameLength = stringWidth ( optionName ) ;
486
491
const fullLength = optionNameLength > this . dotswidth ? optionNameLength + 1 : this . dotswidth ;
@@ -491,8 +496,9 @@ export class CommandStringHelpFormatter<C extends ICommand<C, N, M, I, O>, N ext
491
496
) ;
492
497
493
498
const wrappedDescription = wordWrap ( fullDescription , { indentation : this . dotswidth + 6 } ) ;
499
+ const line = `${ optionName } ${ weak ( '.' ) . repeat ( fullLength - optionNameLength ) } ${ wrappedDescription } ` ;
494
500
495
- return ` ${ optionName } ${ weak ( '.' ) . repeat ( fullLength - optionNameLength ) } ${ wrappedDescription } ` ;
501
+ return wrapColor ( line ) ;
496
502
}
497
503
498
504
/**
0 commit comments