Skip to content

Wrapping the second and following line in a multiline description doesn't work if the line starts from space #1822

@bk201-

Description

@bk201-

I wanted to add an indent to the second line in the description.

program
  .option('--config <path>', 'Configuration file path')
  .option(
    '-M, --message-pattern <RegExp>',
    `Message pattern to configure where JIRA ticket number will be inserted
    * Symbols '$J' 
    * Symbols '$M' `,
  );

I've expected something like this

Usage: index [options]   
                                       
Options:                          
  --config <path>                 Configuration file path
  -M, --message-pattern <RegExp>  Message pattern to configure where JIRA ticket number will be inserted
                                     * Symbols `$J` 
                                     * Symbols `$M`
  -h, --help                      display help for command         

But got:

Usage: index [options]   
                                       
Options:                          
  --config <path>                 Configuration file path
  -M, --message-pattern <RegExp>  Message pattern to configure where JIRA ticket number will be inserted
      * Symbols '$J'
      * Symbols '$M'
  -h, --help                      display help for command  

I tried to change the template literal to a string but got the same result.

program
  .option('--config <path>', 'Configuration file path')
  .option(
    '-M, --message-pattern <RegExp>',
    'Message pattern to configure where JIRA ticket number will be inserted\n' +
    '   * Symbols `$J`\n' +
    '   * Symbols `$M`',
 // ↑ three spaces
  );

But if I remove leading spaces from the second and third line, the indent will work correctly;

Usage: index [options]

Options:
  --config <path>                 Configuration file path
  -M, --message-pattern <RegExp>  Message pattern to configure where JIRA ticket number will be inserted
                                  * Symbols `$J`
                                  * Symbols `$M`
  -h, --help                      display help for command

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsREADME (or other docs) could be improved

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions