Skip to content

adityajanjanam/my-node-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My CLI Tool 🚀

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.

Features ✨

  • 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

Installation

Local Development

  1. Clone or navigate to this directory:
cd my-cli
  1. Install dependencies:
npm install
  1. Link the CLI globally (for local testing):
npm link

Global Installation (when published)

npm install -g my-cli

Usage

Command Reference

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

Help & Version

mycli --help
mycli greet --help
mycli --version

Project Structure

my-cli/
 ├─ index.js          # Main CLI entry point
 ├─ package.json      # Project configuration
 ├─ README.md         # Documentation
 └─ node_modules/     # Dependencies

How it works

  • 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 uses crypto.

Dependencies

  • commander - Command-line interface framework
  • chalk - Terminal string styling
  • inquirer - Interactive command-line prompts

Contributing / Local dev

git clone https://github.com/adityajanjanam/my-node-cli
cd my-node-cli
npm install
npm link   # optional, to use `mycli` globally during dev

Run commands:

mycli --help
node index.js info

Development

To test changes locally:

  1. Make your changes to index.js
  2. Run commands using mycli (if linked with npm link)
  3. Or test directly: node index.js [command]

Publishing to npm

# Login to npm
npm login

# Publish package
npm publish

Next Steps 💡

Ideas 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

License

ISC


Built with ❤️ as a learning project

About

A practical Node.js CLI using Commander, Chalk, and Inquirer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published