npm commander 7.0.0
v7.0.0

Added

  • .enablePositionalOptions() to let program and subcommand reuse same option ([#1427])
  • .passThroughOptions() to pass options through to other programs without needing -- ([#1427])
  • .allowExcessArguments(false) to show an error message if there are too many command-arguments on command line for the action handler ([#1409])
  • .configureOutput() to modify use of stdout and stderr or customise display of errors ([#1387])
  • use .addHelpText() to add text before or after the built-in help, for just current command or also for all subcommands ([#1296])
  • enhance Option class ([#1331])
    • allow hiding options from help
    • allow restricting option arguments to a list of choices
    • allow setting how default value is shown in help
  • .createOption() to support subclassing of automatically created options (like .createCommand()) ([#1380])
  • refactor the code generating the help into a separate public Help class ([#1365])
    • support sorting subcommands and options in help
    • support specifying wrap width (columns)
    • allow subclassing Help class
    • allow configuring Help class without subclassing

Changed

  • Breaking: options are stored safely by default, not as properties on the command ([#1409])
    • this especially affects accessing options on program, use program.opts()
    • revert behaviour with .storeOptionsAsProperties()
  • Breaking: action handlers are passed options and command separately ([#1409])
  • deprecated callback parameter to .help() and .outputHelp() (removed from README) ([#1296])
  • Breaking: errors now displayed using process.stderr.write() instead of console.error()
  • deprecate .on('--help') (removed from README) ([#1296])
  • initialise the command description to empty string (previously undefined) ([#1365])
  • document and annotate deprecated routines ([#1349])

Fixed

  • wrapping bugs in help ([#1365])
    • first line of command description was wrapping two characters early
    • pad width calculation was not including help option and help command
    • pad width calculation was including hidden options and commands
  • improve backwards compatibility for custom command event listeners ([#1403])

Deleted

  • Breaking: .passCommandToAction() ([#1409])
    • no longer needed as action handler is passed options and command
  • Breaking: "extra arguments" parameter to action handler ([#1409])
    • if being used to detect excess arguments, there is now an error displayed by default
latest releases: 8.3.0, 8.2.0, 8.1.0...
9 months ago