MyCLI is a robust, fully-functional Command Line Interface (CLI) application built using Node.js, TypeScript, and Object-Oriented Programming (OOP) concepts.
- 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).
- Node.js (v16.x or later)
- Git
-
Clone the repository and navigate to the project directory:
git clone <your-repository-url> cd mycli
-
Install dependencies:
npm install
-
Build the TypeScript code:
npm run build
-
You can run the CLI locally using
npm startor by executing the compiled output directly:node ./dist/index.js --help
-
(Optional) Install the CLI globally to use
myclifrom anywhere:npm link
| 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 |
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/defunktChecking Current Weather:
$ mycli weather "New York"
Location: New York, United States
Temperature: 21.5°C
Wind Speed: 8.5 km/hCalculations:
$ mycli calc 15 / 3
Result: 5Generating multiple UUIDs:
$ mycli uuid -c 3
45408fd6-2009-4ffc-ba30-74e2a6d8fe88
2f763ab3-275d-4f18-91c6-4d7a8581fdba
3f4bc72a-6091-4e78-bbb2-7d2d0ab13809src/index.ts: Controller/Entrypoint initializing and registering commands.src/commands.ts: Concrete command classes (extendingBaseCommand) orchestrating actions and enforcing separation of concerns.src/services/api.ts: API service wrappers allowing external data fetches, isolating API logic.
ISC