The complete solution for Node.js command-line interfaces
open sourceMITfree
Commander.js is a Node.js library for building command-line interfaces. You declare a program's options (boolean, value, negatable, variadic and required ones, with defaults and custom parsing), its commands and their arguments, and action handlers, and Commander parses the arguments, runs the matching handler, and generates help and a version option for you. It supports stand-alone executable subcommands and life-cycle hooks, and an optional extra-typings package adds strong TypeScript types for options and action parameters.
Problems it solves
- parse command-line options and subcommands in a Node.js script
- generate --help output for my Node CLI automatically
- add a version flag and required options to a Node.js command-line tool
Features
- option types: boolean, value, negatable, variadic and required
- commands with arguments and action handlers
- stand-alone executable subcommands
- automated, customisable help
- version option
- life-cycle hooks
Alternatives
The same job
These do what Commander.js does.
- oclif Salesforce's open CLI framework for building Node.js command-line tools
- yargs Parse command-line arguments and build CLIs in Node.js
- meow Small helper for building Node.js command-line apps
- minimist Minimal command-line argument parser for Node.js
- Inquirer.js Interactive command-line prompts for Node.js
