Commander.js: requiredOption make `--help` invalid

Created on 14 Nov 2019  路  2Comments  路  Source: tj/commander.js

when i set requiredOption on program, the --help will noneffective:

const program = new commander.Command()
program.version('0.0.1')
program
  .requiredOption('-d, --dir <path>', 'dir path')
  .option('-t, --timeout <number>', 'timeout')

when use -h, will get a error, but not the help info:

$ ./app.js -h
error: required option '-d, --dir <path>' not specified

Most helpful comment

Try updating to Commander v4.0.1, which fixes that issue (#1089 #1091).

https://github.com/tj/commander.js/releases/tag/4.0.1

All 2 comments

Try updating to Commander v4.0.1, which fixes that issue (#1089 #1091).

https://github.com/tj/commander.js/releases/tag/4.0.1

@shadowspawn thank you !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shadowspawn picture shadowspawn  路  4Comments

cmoulliard picture cmoulliard  路  4Comments

RoXioTD picture RoXioTD  路  4Comments

mtrabelsi picture mtrabelsi  路  3Comments

oknoorap picture oknoorap  路  4Comments