@@ -65,7 +65,21 @@ export const HelpConfig = z.object({
6565 /** Style of the help subtitles for commands, options and examples */
6666 subtitleStyle : StringStyle . optional ( ) ,
6767 /** Style of the help usage */
68- usageStyle : StringStyle . optional ( ) ,
68+ usageStyle : z
69+ . object ( {
70+ /** Style of the help usage title - appears before the usage text (custom or auto) */
71+ prefix : StringStyle . optional ( ) ,
72+ /**
73+ * For custom usage text, this is the primary style used (right after the `prefix` style).
74+ * For automated usage text, this style is used for the command/binary name
75+ */
76+ main : StringStyle . optional ( ) ,
77+ /** Style of the help usage commands (if any) */
78+ command : StringStyle . optional ( ) ,
79+ /** Style of the help usage options (if any) */
80+ options : StringStyle . optional ( ) ,
81+ } )
82+ . optional ( ) ,
6983 /** Style of the help header */
7084 headerStyle : StringStyle . optional ( ) ,
7185 /** Style of the help footer */
@@ -143,8 +157,19 @@ export const defaultHelpConfig: DeepRequired<HelpConfig> = {
143157 color : 'yellow' ,
144158 } ,
145159 usageStyle : {
146- bold : true ,
147- color : 'yellow' ,
160+ prefix : {
161+ bold : true ,
162+ color : 'brightWhite' ,
163+ } ,
164+ main : {
165+ color : 'yellow' ,
166+ } ,
167+ command : {
168+ color : 'gray' ,
169+ } ,
170+ options : {
171+ color : 'gray' ,
172+ } ,
148173 } ,
149174 subtitleStyle : {
150175 bold : true ,
@@ -218,7 +243,6 @@ export class HelpGenerator {
218243 ) ,
219244 4 ,
220245 ) ,
221- '' ,
222246 )
223247 } )
224248 . join ( '\n' )
@@ -227,13 +251,19 @@ export class HelpGenerator {
227251 return (
228252 strConcat (
229253 _wrap (
230- format (
231- usageText ||
232- [ `Usage:` , entry . name , commands . length && '[command]' , options . length && '[options]' ]
254+ usageText
255+ ? strConcat (
256+ format ( 'Usage:' , this . config . usageStyle . prefix ) ,
257+ format ( usageText , this . config . usageStyle . command ) ,
258+ )
259+ : [
260+ format ( `Usage:` , this . config . usageStyle . prefix ) ,
261+ format ( entry . name , this . config . usageStyle . main ) ,
262+ commands . length && format ( '[command]' , this . config . usageStyle . command ) ,
263+ options . length && format ( '[options]' , this . config . usageStyle . options ) ,
264+ ]
233265 . filter ( Boolean )
234266 . join ( ' ' ) ,
235- this . config . usageStyle ,
236- ) ,
237267 ) ,
238268 headerText . length && [ '' , format ( headerText , this . config . descriptionStyle ) ] ,
239269 entry . description . length && [
0 commit comments