@@ -57,9 +57,9 @@ export const HelpConfig = z.object({
5757 inputStyle : StringStyle . optional ( ) ,
5858 /** Style of the example output */
5959 outputStyle : StringStyle . optional ( ) ,
60- /** Prefix for the example input */
60+ /** Prefix for the example input (default: `$`) */
6161 inputPrefix : z . string ( ) . default ( '$' ) . optional ( ) ,
62- /** Prefix for the example output */
62+ /** Prefix for the example output (default: `>`) */
6363 outputPrefix : z . string ( ) . default ( '>' ) . optional ( ) ,
6464 } )
6565 . optional ( ) ,
@@ -176,24 +176,24 @@ export class HelpGenerator {
176176 return strConcat (
177177 description && [
178178 _wrap ( format ( description , this . config . exampleOptions . descriptionStyle ) , 4 ) ,
179- '' ,
180179 ] ,
181180 input &&
182- _wrap (
183- format (
184- [ this . config . exampleOptions . inputPrefix , input ] . filter ( Boolean ) . join ( ' ' ) ,
185- this . config . exampleOptions . inputStyle ,
186- ) ,
187- 4 ,
181+ _wrap (
182+ format (
183+ [ this . config . exampleOptions . inputPrefix , input ] . filter ( Boolean ) . join ( ' ' ) ,
184+ this . config . exampleOptions . inputStyle ,
188185 ) ,
186+ 4 ,
187+ ) ,
189188 output &&
190- _wrap (
191- format (
192- [ this . config . exampleOptions . outputPrefix , output ] . filter ( Boolean ) . join ( ' ' ) ,
193- this . config . exampleOptions . outputStyle ,
194- ) ,
195- 4 ,
189+ _wrap (
190+ format (
191+ [ this . config . exampleOptions . outputPrefix , output ] . filter ( Boolean ) . join ( ' ' ) ,
192+ this . config . exampleOptions . outputStyle ,
196193 ) ,
194+ 4 ,
195+ ) ,
196+ '' ,
197197 )
198198 } )
199199 . join ( '\n' )
@@ -204,9 +204,9 @@ export class HelpGenerator {
204204 _wrap (
205205 format (
206206 usageText ||
207- [ `Usage:` , entry . name , commands . length && '[command]' , options . length && '[options]' ]
208- . filter ( Boolean )
209- . join ( ' ' ) ,
207+ [ `Usage:` , entry . name , commands . length && '[command]' , options . length && '[options]' ]
208+ . filter ( Boolean )
209+ . join ( ' ' ) ,
210210 this . config . usageStyle ,
211211 ) ,
212212 ) ,
@@ -216,21 +216,27 @@ export class HelpGenerator {
216216 _wrap ( format ( entry . description , this . config . descriptionStyle ) ) ,
217217 ] ,
218218 commands . length &&
219- indent ( [
220- '' ,
221- format ( `Commands for ${ entry . name } :` , this . config . subtitleStyle ) ,
222- '' ,
223- indent ( commands ) ,
224- ] ) ,
219+ indent ( [
220+ '' ,
221+ format (
222+ entry . parent ? `Commands for ${ entry . name } :` : 'Commands:' ,
223+ this . config . subtitleStyle ,
224+ ) ,
225+ '' ,
226+ indent ( commands ) ,
227+ ] ) ,
225228 options . length &&
226- indent ( [
227- '' ,
228- format ( `Options for ${ entry . name } :` , this . config . subtitleStyle ) ,
229- '' ,
230- indent ( options ) ,
231- ] ) ,
229+ indent ( [
230+ '' ,
231+ format (
232+ entry . parent ? `Options for ${ entry . name } :` : 'Options:' ,
233+ this . config . subtitleStyle ,
234+ ) ,
235+ '' ,
236+ indent ( options ) ,
237+ ] ) ,
232238 examples . length &&
233- indent ( [ '' , format ( 'Examples:' , this . config . subtitleStyle ) , '' , indent ( examples ) ] ) ,
239+ indent ( [ '' , format ( 'Examples:' , this . config . subtitleStyle ) , '' , indent ( examples ) ] ) ,
234240 footerText . length && [ '' , _wrap ( format ( footerText , this . config . descriptionStyle ) ) ] ,
235241 ) + '\n'
236242 )
@@ -274,9 +280,8 @@ function generateHelpTable<T extends Partial<GenerateTableCommandConfig>>(
274280) : string {
275281 const rows = items
276282 . map ( ( o ) => {
277- const name = `${ namePrefix } ${ o . name } ${
278- o . aliases . length ? ` | ${ aliasPrefix } ${ o . aliases . join ( `|${ aliasPrefix } ` ) } ` : ''
279- } `
283+ const name = `${ namePrefix } ${ o . name } ${ o . aliases . length ? ` | ${ aliasPrefix } ${ o . aliases . join ( `|${ aliasPrefix } ` ) } ` : ''
284+ } `
280285 const description = o . description
281286 const hidden = o . hidden || false
282287 return { name, description, hidden }
0 commit comments