Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MyCLI - Node.js & TypeScript CLI Tool

MyCLI is a robust, fully-functional Command Line Interface (CLI) application built using Node.js, TypeScript, and Object-Oriented Programming (OOP) concepts.

🚀 Features

  • Built with Node.js and TypeScript.
  • Designed using Object-Oriented Programming (OOP) methodology.
  • Includes 11 custom commands to handle various tasks.
  • Integrates with 3 external APIs (GitHub, Weather, Quotes).
  • Advanced capabilities: Colored CLI output (chalk), Help descriptions & versions (commander), and parameter validation (zod).

📋 Setup Instructions

Prerequisites

Installation

  1. Clone the repository and navigate to the project directory:

    git clone <your-repository-url>
    cd mycli
  2. Install dependencies:

    npm install
  3. Build the TypeScript code:

    npm run build
  4. You can run the CLI locally using npm start or by executing the compiled output directly:

    node ./dist/index.js --help
  5. (Optional) Install the CLI globally to use mycli from anywhere:

    npm link

🛠 Available Commands

Command Description Example Usage
greet <name> Greet a user by name mycli greet Alice or mycli greet Bob -s
fileinfo <filename> Get detailed information about a file mycli fileinfo package.json
github <username> Fetch a GitHub user's profile information mycli github torvalds
weather <city> Fetch current weather data for any given city mycli weather Paris
quote Fetch and print a randomly generated quote mycli quote
uuid Generate a random UUID mycli uuid or mycli uuid -c 5
b64enc <text> Encode a normal string to Base64 format mycli b64enc "hello"
b64dec <text> Decode a Base64 string back to ASCII text mycli b64dec "aGVsbG8="
calc <a> <op> <b> Basic calculator with +, -, *, / options mycli calc 5 + 10
echo <words...> Echo back the exact words you inputted mycli echo hello world
sysinfo Print memory and CPU status of the Node process mycli sysinfo

🌟 Example Usage

Greetings with the --shout flag:

$ mycli greet "John Doe" -s
HELLO, JOHN DOE!

Fetching GitHub user information:

$ mycli github defunkt
User: Chris Wanstrath
Followers: 22643 | Following: 215
Public Repos: 107
URL: https://github.com/defunkt

Checking Current Weather:

$ mycli weather "New York"
Location: New York, United States
Temperature: 21.5°C
Wind Speed: 8.5 km/h

Calculations:

$ mycli calc 15 / 3
Result: 5

Generating multiple UUIDs:

$ mycli uuid -c 3
45408fd6-2009-4ffc-ba30-74e2a6d8fe88
2f763ab3-275d-4f18-91c6-4d7a8581fdba
3f4bc72a-6091-4e78-bbb2-7d2d0ab13809

🏗 Project Structure (OOP Concept)

  • src/index.ts: Controller/Entrypoint initializing and registering commands.
  • src/commands.ts: Concrete command classes (extending BaseCommand) orchestrating actions and enforcing separation of concerns.
  • src/services/api.ts: API service wrappers allowing external data fetches, isolating API logic.

📄 License

ISC

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages