refactor: upgrade commander from 5.1.0 to 8.3.0 #7791
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Snyk has created this PR to upgrade commander from 5.1.0 to 8.3.0.
ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
Warning: This is a major version upgrade, and may be a breaking change.
Release notes
Package name: commander
Added
.getOptionValueSource()
and.setOptionValueWithSource()
, where expected values for source are one of 'default', 'env', 'config', 'cli' (#1613)Deprecated
.command('*')
, use default command instead (#1612)on('command:*')
, use.showSuggestionAfterError()
instead (#1612)Added
.showSuggestionAfterError()
to show suggestions after unknown command or unknown option (#1590)Option
support for values from environment variables using.env()
(#1587)Changed
Removed
Option
methodargumentRejected
Added
.copyInheritedSettings()
(#1557)Argument
methods for.argRequired()
and.argOptional()
(#1567)Added
.argument(name, description)
for adding command-arguments (#1490).createArgument()
factory method (#1497).addArgument()
(#1490)Argument
supports.choices()
(#1525).showHelpAfterError()
to display full help or a custom message after an error (#1534).hook()
with support for'preAction'
and'postAction'
callbacks (#1514).opts()
return type using TypeScript generics (#1539).getOptionValue()
and.setOptionValue()
(#1521)Changed
.parseAsync()
is now declared asasync
(#1513)Help
method.visibleArguments()
returns array ofArgument
(#1490)CommanderError
codecommander.invalidOptionArgument
renamedcommander.invalidArgument
(#1508).addTextHelp()
callback no longer allows result ofundefined
, now juststring
(#1516)index.tab
into a file per class (#1522).showHelpAfteError()
) (#1534)Command
property.arg
initialised to empty array (was previously undefined) (#1529)Deprecated
cmd.description(desc, argDescriptions)
for adding argument descriptions (#1490).argument(name, description)
instead)InvalidOptionArgumentError
(replaced byInvalidArgumentError
) (#1508)Removed
Command
object (#1520)program
export)Migration Tips
If you have a simple program without an action handler, you will now get an error if
there are missing command-arguments.
$ node trivial.js error: missing required argument 'file'
If you want to show the help in this situation, you could check the arguments before parsing:
Or, you might choose to show the help after any user error:
Added
.showHelpAfterError()
to display full help or a custom message after an error (#1534)Changed
.showHelpAfteError()
) (#1534)Command
property.arg
initialised to empty array (was previously undefined) (#1529)Added
.addArgument()
(#1490)Argument
supports.choices()
(#1525).opts()
return type using TypeScript generics (#1539)Changed
index.tab
into a file per class (#1522)Read more
Added
parent
property onCommand
(#1475).attributeName()
onOption
(#1483)Changed
Read more
Read more
Commit messages
Package name: commander
Compare
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
🧐 View latest project report
🛠 Adjust upgrade PR settings
🔕 Ignore this dependency or unsubscribe from future upgrade PRs