Commander.js
Developer CLI · Free
A Node.js command and argument parser: helps build a project tool's CLI with subcommands, options, and help.
Also known as: tj/commander.js; commander.js; nodejs-command-line

What you can use for free
Code and local use under MIT.
Paid features and costs
Computing resources, self-hosting, and external services are paid for separately if used.
Access and limitations
Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.
Use cases
- Create a CLI with commands and parameters
- Connect parsed arguments to handlers and error diagnostics
Example workflow
A possible workflow; this is not a report of hands-on testing.
Create a CLI with commands and parameters.
Before you start
- Project files or environment.
- A shell and supported platform.
Steps
- Describe the tool's subcommands, options, and help.
- Connect parsed arguments to handlers and error diagnostics.
- Save the working command or script and the result criteria.
Check your result
- The command correctly handles paths, Unicode, and invalid inputs.
- Repeat runs behave predictably; credentials do not appear in the output.
Choosing Commander.js
Create a CLI with commands and parameters
Choose this when
- Create a CLI with commands and parameters
- Connect parsed arguments to handlers and error diagnostics
Things to consider
- Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
- Terms of use: MIT for the code; dependencies have separate licenses.
- An option with a required value consumes the next argument even if it starts with a hyphen; an optional-value option behaves differently.
Frequently asked questions
What can you use for free in Commander.js?
Code and local use under MIT.
What additional costs might arise with Commander.js?
Computing resources, self-hosting, and external services are paid for separately if used.
What terms of use matter for Commander.js?
MIT for the code; dependencies have separate licenses.
How do you get started with Commander.js?
Describe the tool's subcommands, options, and help. Connect parsed arguments to handlers and error diagnostics. Save the working command or script and the result criteria.
How does Commander distinguish required, optional, and multiple option values?
<value> requires the following value, [value] allows a boolean without it, and ... collects multiple values. requiredOption requires an option to be set; -- ends option parsing. Unknown flags produce an error by default, and help is built from command/option descriptions.
License
MIT for the code; dependencies have separate licenses.
MIT — permissive license
You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.
License termsTechnologies and topics
- Commander.js
- CLI
- Development