Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelogarrow-up-right and this project adheres to Semantic Versioningarrow-up-right. (Format adopted after v3.0.0.)

6.2.1arrow-up-right (2020-12-13)

Fixed

  • some tests failed if directory path included a space ([1390])

6.2.0arrow-up-right (2020-10-25)

Added

Fixed

Changed

  • update dependencies

6.1.0arrow-up-right (2020-08-28)

Added

  • include URL to relevant section of README for error for potential conflict between Command properties and option values (#1306arrow-up-right)

  • .combineFlagAndOptionalValue(false) to ease upgrade path from older versions of Commander (#1326arrow-up-right)

  • allow disabling the built-in help option using .helpOption(false) (#1325arrow-up-right)

  • allow just some arguments in argumentDescription to .description() (#1323arrow-up-right)

Changed

Fixed

6.0.0arrow-up-right (2020-07-21)

Added

  • add support for variadic options (#1250arrow-up-right)

  • allow options to be added with just a short flag (#1256arrow-up-right)

    • Breaking the option property has same case as flag. e.g. flag -n accessed as opts().n (previously uppercase)

  • Breaking throw an error if there might be a clash between option name and a Command property, with advice on how to resolve (#1275arrow-up-right)

Fixed

  • Options which contain -no- in the middle of the option flag should not be treated as negatable. (#1301arrow-up-right)

(Released in 6.0.0)

5.1.0arrow-up-right (2020-04-25)

Added

Fixed

Changed

  • remove use of arguments to improve auto-generated help in editors (#1235arrow-up-right)

  • rename .command() configuration noHelp to hidden (but not remove old support) (#1232arrow-up-right)

  • improvements to documentation

  • update dependencies

  • update tested versions of node

  • eliminate lint errors in TypeScript (#1208arrow-up-right)

5.0.0arrow-up-right (2020-03-14)

Added

Fixed

Changed

  • Breaking .args contains command arguments with just recognised options removed (#1032arrow-up-right #1138arrow-up-right)

  • Breaking display error if required argument for command is missing (#995arrow-up-right #1149arrow-up-right)

  • tighten TypeScript definition of custom option processing function passed to .option() (#1119arrow-up-right)

  • Breaking .allowUnknownOption() (#802arrow-up-right #1138arrow-up-right)

    • unknown options included in arguments passed to command action handler

    • unknown options included in .args

  • only recognised option short flags and long flags are expanded (e.g. -ab or --foo=bar) (#1145arrow-up-right)

  • Breaking .parseOptions() (#1138arrow-up-right)

    • args in returned result renamed operands and does not include anything after first unknown option

    • unknown in returned result has arguments after first unknown option including operands, not just options and values

  • Breaking .on('command:*', callback) and other command events passed (changed) results from .parseOptions, i.e. operands and unknown (#1138arrow-up-right)

  • refactor Option from prototype to class (#1133arrow-up-right)

  • refactor Command from prototype to class (#1159arrow-up-right)

  • changes to error handling (#1165arrow-up-right)

    • throw for author error, not just display message

    • preflight for variadic error

    • add tips to missing subcommand executable

  • TypeScript fluent return types changed to be more subclass friendly, return this rather than Command (#1180arrow-up-right)

  • .parseAsync returns Promise<this> to be consistent with .parse() (#1180arrow-up-right)

  • update dependencies

Removed

  • removed EventEmitter from TypeScript definition for Command, eliminating implicit peer dependency on @types/node (#1146arrow-up-right)

  • removed private function normalize (the functionality has been integrated into parseOptions) (#1145arrow-up-right)

  • parseExpectedArgs is now private (#1149arrow-up-right)

Migration Tips

If you use .on('command:*') or more complicated tests to detect an unrecognised subcommand, you may be able to delete the code and rely on the default behaviour.

If you use program.args or more complicated tests to detect a missing subcommand, you may be able to delete the code and rely on the default behaviour.

If you use .command('*') to add a default command, you may be be able to switch to isDefault:true with a named command.

If you want to continue combining short options with optional values as though they were boolean flags, set combineFlagAndOptionalValue(false) to expand -fb to -f -b rather than -f b.

(Released in 5.0.0)

(Released in 5.0.0)

(Released in 5.0.0)

(Released in 5.0.0)

(Released in 5.0.0)

4.1.1arrow-up-right (2020-02-02)

Fixed

4.1.0arrow-up-right (2020-01-06)

Added

  • two routines to change how option values are handled, and eliminate name clashes with command properties ([#933] #1102arrow-up-right)

    • see storeOptionsAsProperties and passCommandToAction in README

  • .parseAsync to use instead of .parse if supply async action handlers (#806arrow-up-right #1118arrow-up-right)

Fixed

Changed

  • update dependencies

  • extend security coverage for Commander 2.x to 2020-02-03

  • improvements to README

  • improvements to TypeScript definition documentation

  • move old versions out of main CHANGELOG

  • removed explicit use of ts-node in tests

4.0.1arrow-up-right (2019-11-12)

Fixed

4.0.0arrow-up-right (2019-11-02)

Added

  • automatically wrap and indent help descriptions for options and commands (#1051arrow-up-right)

  • .exitOverride() allows override of calls to process.exit for additional error handling and to keep program running (#1040arrow-up-right)

  • support for declaring required options with .requiredOptions() (#1071arrow-up-right)

  • GitHub Actions support (#1027arrow-up-right)

  • translation links in README

Changed

Fixed

  • Breaking keep command object out of program.args when action handler called (#1048arrow-up-right)

    • also, action handler now passed array of unknown arguments

  • complain about unknown options when program argument supplied and action handler (#1049arrow-up-right)

    • this changes parameters to command:* event to include unknown arguments

  • removed deprecated customFds option from call to child_process.spawn (#1052arrow-up-right)

  • rework TypeScript declarations to bring all types into imported namespace (#1081arrow-up-right)

Migration Tips

Testing for no arguments

If you were previously using code like:

a partial replacement is:

4.0.0-1arrow-up-right Prerelease (2019-10-08)

(Released in 4.0.0)

4.0.0-0arrow-up-right Prerelease (2019-10-01)

(Released in 4.0.0)

Older versions

Last updated