Practical Node.js CLI showcasing multiple real-world utilities: quick greetings, interactive prompts, system info, text transforms, hashing, password generation, filesystem helpers, scaffolding, and more. Great as a portfolio-ready starter.
- 12+ useful commands (greet, intro, info, echo, genpass, hash, base64, calc, ls, mkdir, quote, json, init)
- Interactive prompts with Inquirer
- Colorful output with Chalk
- Sensible defaults and helpful flags
- Ready to publish or extend
- Clone or navigate to this directory:
cd my-cli- Install dependencies:
npm install- Link the CLI globally (for local testing):
npm linknpm install -g my-cli| Command | Description | Examples |
|---|---|---|
mycli greet <name> [--uppercase] |
Friendly greeting | mycli greet Aditya · mycli greet dev --uppercase |
mycli intro |
Interactive intro (name + role prompt) | mycli intro |
mycli info |
Show Node/platform/arch/cwd | mycli info |
mycli echo <message...> [--color <c>] |
Echo text with color (red, green, blue, yellow, white) | mycli echo "Hello" --color blue |
mycli genpass [--length <n>] [--no-symbols] |
Secure random password | mycli genpass -l 20 |
| `mycli hash [--algorithm <md5 | sha256 | sha512>]` |
mycli base64 <text> [--decode] |
Base64 encode/decode | mycli base64 "Hello" · mycli base64 SGVsbG8= --decode |
mycli calc <expression> |
Quick calculator (basic operators) | mycli calc "25 * 4 + 10" |
mycli ls [directory] [--all] |
List files/dirs with sizes | mycli ls · mycli ls .. --all |
mycli mkdir <dirname> |
Create directory (recursive) | mycli mkdir sandbox/demo |
mycli quote |
Random motivational dev quote | mycli quote |
mycli json <file> [--minify] |
Validate/format/minify JSON (optional save prompt) | mycli json data.json |
mycli init |
Scaffold a simple project (prompts for name/type/git) | mycli init |
mycli --help
mycli greet --help
mycli --versionmy-cli/
├─ index.js # Main CLI entry point
├─ package.json # Project configuration
├─ README.md # Documentation
└─ node_modules/ # Dependencies
- Commander wires subcommands, options, and help output.
- Chalk colors messages; defaults to plain text if color missing.
- Inquirer powers interactive flows (
intro,json,init). - File utilities use Node’s
fs/path; hashing usescrypto.
- commander - Command-line interface framework
- chalk - Terminal string styling
- inquirer - Interactive command-line prompts
git clone https://github.com/adityajanjanam/my-node-cli
cd my-node-cli
npm install
npm link # optional, to use `mycli` globally during devRun commands:
mycli --help
node index.js infoTo test changes locally:
- Make your changes to
index.js - Run commands using
mycli(if linked withnpm link) - Or test directly:
node index.js [command]
# Login to npm
npm login
# Publish package
npm publishIdeas to extend this CLI:
- Add file system operations
- Create project templates/boilerplates
- Add API integration
- Build a task manager
- Add configuration file support
- Create interactive menus
ISC
Built with ❤️ as a learning project