A hands-on example project demonstrating how to create interactive command-line interfaces with Node.js. Companion repo for the Medium article Building a CLI with Node.js in 2024.
This project includes interactive examples for popular CLI libraries:
| Example | Library | What it demonstrates |
|---|---|---|
| Basic Example | Node.js | Simple console output |
| Chalk Example | chalk | Colored terminal output |
| Figlet Example | figlet | ASCII art text banners |
| Inquirer Example | inquirer | Interactive text prompts |
| Inquirer Confirm | inquirer | Yes/no confirmation prompts |
| Inquirer List | inquirer | Selection list prompts |
| Ora Example | ora | Terminal spinners |
# Clone the repository
git clone https://github.com/gomzkov/my-node-cli.git
# Navigate to project
cd my-node-cli
# Install dependencies
npm install
# Link globally (optional)
npm linkRun the CLI to see all examples:
# If linked globally
my-node-cli
# Or run directly
npm startSelect an example from the interactive menu to see it in action.
This project demonstrates these essential CLI libraries:
- Commander β CLI framework with commands and options
- Chalk β Terminal string styling
- Figlet β ASCII art text generation
- Inquirer β Interactive command line prompts
- Ora β Elegant terminal spinners
my-node-cli/
βββ bin/
β βββ index.js # CLI entry point
βββ src/
β βββ commands/ # Example implementations
β βββ basic-example.js
β βββ chalk-example.js
β βββ figlet-example.js
β βββ inquirer-example.js
β βββ inquirer-confirm-example.js
β βββ inquirer-list-example.js
β βββ ora-example.js
βββ package.json
βββ README.md
Read the full tutorial on Medium: Building a CLI with Node.js in 2024
MIT

