@@ -54,36 +54,68 @@ describe('override style methods and check help information', () => {
54
54
) ;
55
55
} ) ;
56
56
57
- test ( 'styleItemDescription ' , ( ) => {
57
+ test ( 'styleCommandDescription ' , ( ) => {
58
58
const program = makeProgram ( ) ;
59
59
program . configureHelp ( {
60
- styleItemDescription : ( str ) => red ( str ) ,
60
+ styleCommandDescription : ( str ) => red ( str ) ,
61
61
displayWidth,
62
62
} ) ;
63
63
const helpText = program . helpInformation ( ) ;
64
64
expect ( helpText ) . toEqual (
65
- plainHelpInformation
66
- . replace ( 'arg description', red ( 'arg description' ) )
67
- . replace ( 'sub description' , red ( 'sub description' ) )
68
- . replace ( / d i s p l a y h e l p f o r c o m m a n d / g , red ( 'display help for command' ) ) ,
65
+ plainHelpInformation . replace (
66
+ 'program description',
67
+ red ( 'program description' ) ,
68
+ ) ,
69
69
) ;
70
70
} ) ;
71
71
72
- test ( 'styleCommandDescription ' , ( ) => {
72
+ test ( 'styleOptionDescription ' , ( ) => {
73
73
const program = makeProgram ( ) ;
74
74
program . configureHelp ( {
75
- styleCommandDescription : ( str ) => red ( str ) ,
75
+ styleOptionDescription : ( str ) => red ( str ) ,
76
76
displayWidth,
77
77
} ) ;
78
78
const helpText = program . helpInformation ( ) ;
79
79
expect ( helpText ) . toEqual (
80
80
plainHelpInformation . replace (
81
- 'program description' ,
82
- red ( 'program description' ) ,
81
+ / ( - h , - - h e l p * ) ( d i s p l a y h e l p f o r c o m m a n d ) / ,
82
+ ( match , p1 , p2 ) => p1 + red ( p2 ) ,
83
83
) ,
84
84
) ;
85
85
} ) ;
86
86
87
+ test ( 'styleSubcommandDescription' , ( ) => {
88
+ const program = makeProgram ( ) ;
89
+ program . configureHelp ( {
90
+ styleSubcommandDescription : ( str ) => red ( str ) ,
91
+ displayWidth,
92
+ } ) ;
93
+ const helpText = program . helpInformation ( ) ;
94
+ expect ( helpText ) . toEqual (
95
+ plainHelpInformation
96
+ . replace (
97
+ / ( \[ s u b a r g \] * ) ( s u b d e s c r i p t i o n ) / ,
98
+ ( match , p1 , p2 ) => p1 + red ( p2 ) ,
99
+ )
100
+ . replace (
101
+ / ( h e l p \[ c o m m a n d \] * ) ( d i s p l a y h e l p f o r c o m m a n d ) / ,
102
+ ( match , p1 , p2 ) => p1 + red ( p2 ) ,
103
+ ) ,
104
+ ) ;
105
+ } ) ;
106
+
107
+ test ( 'styleArgumentDescription' , ( ) => {
108
+ const program = makeProgram ( ) ;
109
+ program . configureHelp ( {
110
+ styleArgumentDescription : ( str ) => red ( str ) ,
111
+ displayWidth,
112
+ } ) ;
113
+ const helpText = program . helpInformation ( ) ;
114
+ expect ( helpText ) . toEqual (
115
+ plainHelpInformation . replace ( 'arg description' , red ( 'arg description' ) ) ,
116
+ ) ;
117
+ } ) ;
118
+
87
119
test ( 'styleDescriptionText' , ( ) => {
88
120
const program = makeProgram ( ) ;
89
121
program . configureHelp ( {
0 commit comments