@@ -74,6 +74,10 @@ function description(command: CliSubcommand | undefined): string {
74
74
return indentString ( str , HELP_PAD_NAME ) . trimStart ( )
75
75
}
76
76
77
+ function trimNewlines ( str : string ) : string {
78
+ return str . replace ( / ^ \n + | \n + $ / g, '' )
79
+ }
80
+
77
81
// For debugging. Whenever you call meowOrExit it will store the command here
78
82
// This module exports a getter that returns the current value.
79
83
let lastSeenCommand = ''
@@ -486,7 +490,7 @@ export function meowOrExit({
486
490
collectUnknownFlags : true ,
487
491
description : config . description ,
488
492
flags : config . flags ,
489
- help : config . help ( command , config ) ,
493
+ help : trimNewlines ( config . help ( command , config ) ) ,
490
494
importMeta,
491
495
} )
492
496
@@ -510,7 +514,7 @@ export function meowOrExit({
510
514
// autoVersion: false,
511
515
// description: config.description,
512
516
// flags: config.flags,
513
- // help: config.help(command, config),
517
+ // help: trimNewlines( config.help(command, config) ),
514
518
// importMeta,
515
519
// })
516
520
// }
@@ -541,7 +545,7 @@ export function meowOrExit({
541
545
autoHelp : false ,
542
546
autoVersion : false ,
543
547
description : config . description ,
544
- help : config . help ( command , config ) ,
548
+ help : trimNewlines ( config . help ( command , config ) ) ,
545
549
importMeta,
546
550
flags : config . flags ,
547
551
} )
0 commit comments