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

