nodeca / argparse

CLI arguments parser for node.js. JS port of python's argparse module.
Other
487 stars 73 forks source link

add_argument fails to fail when provided with invalid arguments #147

Closed marvin1up closed 4 years ago

marvin1up commented 4 years ago
parser.addArgument(['-o', '--out'], {
  help: 'Output file for metadata, default dist/__metadata__.js',
  defaultValue: 'dist/__metadata__.js',
  // required: true,
  useless: 11,
});

This example succeeds, even though useless is not a valid option. Even though this is pretty typical for JS libraries, its wrong here just as it is elsewhere. This particular issue is particularly problematic since the argument default has apparently been renamed to defaultValue so specifying an incorrect option default is silently ignored.

rlidwka commented 4 years ago

Fixed in 2.0 (now default stays default as it is in python, and unrecognized arguments are being thoroughly complained about).