nodeca/argparse

Long strings in help replaced by previous string

phihag opened this issue · 1 comments

I run the following program with --help:

const parser = require('argparse').ArgumentParser();
parser.addArgument('-x', {help: (
    '2 or 12345678901234567890123456789012345678901234567890123456789012345')});
parser.parseArgs();

The output is:

usage: index.js [-h] [-x X]

Optional arguments:
  -h, --help  Show this help message and exit.
  -x X        2 or 
              2 or 

Instead, the output should be 2 or 12345678901234567890123456789012345678901234567890123456789012345, however formatted.

Fixed in argparse.js 2.0:

const parser = require('argparse').ArgumentParser()
parser.add_argument('-x', { help:
    '2 or 12345678901234567890123456789012345678901234567890123456789012345' })
parser.parse_args([ '-h' ])
usage: test.js [-h] [-x X]

optional arguments:
  -h, --help  show this help message and exit
  -x X        2 or 12345678901234567890123456789012345678901234567890123456789012345