commander
Advanced tools
Changelog
[12.1.0] (2024-05-18)
node --eval
and node --print
when call .parse()
with no arguments ([#2164])node:
([#2170])Changelog
[12.0.0] (2024-02-03)
.addHelpOption()
as another way of configuring built-in help option ([#2006]).helpCommand()
for configuring built-in help command ([#2087])passThroughOptions
constraints when using .addCommand
and throw if parent command does not have .enablePositionalOptions()
enabled ([#1937]).storeOptionsAsProperties()
after setting an option value ([#1928])@api private
with documented @private
([#1949]).addHelpCommand()
now takes a Command (passing string or boolean still works as before but deprecated) ([#2087]).addHelpCommand()
passing string or boolean (use .helpCommand()
or pass a Command) ([#2087])program
export instead) ([#2017])global program
If you are using the deprecated default import of the global Command object, you need to switch to using a named import (or create a new Command
).
// const program = require('commander');
const { program } = require('commander');
option and command clashes
A couple of configuration problems now throw an error, which will pick up issues in existing programs:
Changelog
[11.1.0] (2023-10-13)
OptionValueSource
to allow any string, to match supported use of custom sources ([#1983])Command.version()
can also be used as getter ([#1982])Commands.executableDir()
, for when not configured ([#1965])registeredArguments
property on Command
with the array of defined Argument
(like Command.options
for Option
) ([#2010])envVar
, presetArg
([#2019])argChoices
, defaultValue
, defaultValueDescription
([#2019])Command._args
was private anyway, but now available as registeredArguments
([#2010])Changelog
[11.0.0] (2023-06-16)
Changelog
[10.0.1] (2023-04-15)
Option.optionFlags
property from TypeScript definition ([#1844]).implies()
([#1854])Changelog
[10.0.0] (2023-01-13)
Changelog
[9.5.0] (2023-01-07)
.getOptionValueSourceWithGlobals()
([#1832])showGlobalOptions
for .configureHelp{}
and Help
([#1828])Changelog
[9.4.1] (2022-09-30)
.setOptionValue()
now also clears option source ([#1795])implied
to OptionValueSource
for option values set by using .implies()
([#1794])undefined
to return type of .getOptionValueSource()
([#1794])