@@ -74,6 +74,10 @@ function description(command: CliSubcommand | undefined): string {
7474 return indentString ( str , HELP_PAD_NAME ) . trimStart ( )
7575}
7676
77+ function trimNewlines ( str : string ) : string {
78+ return str . replace ( / ^ \n + | \n + $ / g, '' )
79+ }
80+
7781// For debugging. Whenever you call meowOrExit it will store the command here
7882// This module exports a getter that returns the current value.
7983let lastSeenCommand = ''
@@ -486,7 +490,7 @@ export function meowOrExit({
486490 collectUnknownFlags : true ,
487491 description : config . description ,
488492 flags : config . flags ,
489- help : config . help ( command , config ) ,
493+ help : trimNewlines ( config . help ( command , config ) ) ,
490494 importMeta,
491495 } )
492496
@@ -510,7 +514,7 @@ export function meowOrExit({
510514 // autoVersion: false,
511515 // description: config.description,
512516 // flags: config.flags,
513- // help: config.help(command, config),
517+ // help: trimNewlines( config.help(command, config) ),
514518 // importMeta,
515519 // })
516520 // }
@@ -541,7 +545,7 @@ export function meowOrExit({
541545 autoHelp : false ,
542546 autoVersion : false ,
543547 description : config . description ,
544- help : config . help ( command , config ) ,
548+ help : trimNewlines ( config . help ( command , config ) ) ,
545549 importMeta,
546550 flags : config . flags ,
547551 } )
0 commit comments