raman976/CLI_TOOL

★ 0Forks 0TypeScriptGitHub ↗Compare

README

MyCLI - Command Line Tool

A TypeScript-based CLI tool built with Object-Oriented Programming principles. Provides mathematical operations and API integrations.

Installation

npm install
npm link

Usage

mycli <command> [arguments]

Commands

Mathematical Operations

Basic Arithmetic

mycli add 5 3           # Result: 8
mycli subtract 10 4     # Result: 6
mycli multiply 6 7      # Result: 42
mycli divide 20 4       # Result: 5
mycli modulo 17 5       # Result: 2

Advanced Math

mycli power 2 8         # Result: 256
mycli sqrt 144          # Result: 12
mycli factorial 5       # Result: 120

Statistics

mycli average 10 20 30 40    # Result: 25
mycli max 5 12 8 20 3        # Result: 20
mycli min 5 12 8 20 3        # Result: 3

API Integrations

GitHub User Info

mycli github <username>
# Displays user profile, repositories, followers, and more

Random Jokes

mycli joke
# Fetches a random joke from the internet

Pokemon Information

mycli pokemon pikachu
# Shows Pokemon name, height, and weight

Utility

Greet

mycli greet Raman
# Greets you with a colorful message

Project Structure

mycommand/
├── cli.ts                     # Main entry point
├── cliEngine/
│   └── engine.ts             # CLI Engine class
├── commands/
│   ├── addCommand.ts         # Math operations
│   ├── subtractCommand.ts
│   ├── multiplyCommand.ts
│   ├── divideCommand.ts
│   ├── moduloCommand.ts
│   ├── powerCommand.ts
│   ├── squarerootCommand.ts
│   ├── factorialCommand.ts
│   ├── averageCommand.ts
│   ├── maxCommand.ts
│   ├── minCommand.ts
│   ├── githubCommand.ts      # API integrations
│   ├── jokeCommand.ts
│   ├── pokeCommand.ts
│   └── greetCommand.ts       # Utilities
└── package.json

Architecture

Each command is a class with three key components:

  • constructor(program) - Initializes with Commander instance
  • register() - Registers command with CLI engine
  • action methods - Implements command logic

The CLI Engine manages command registration and execution using OOP principles.

Technologies

  • TypeScript
  • Commander.js (CLI framework)
  • Axios (HTTP requests)
  • Chalk (colored output)

Development

npm install          # Install dependencies
npx tsc             # Compile TypeScript
npm link            # Link globally

Contributors

raman976

Issues