This project is a Command-Line Interface (CLI) application for managing a collection of contacts. It allows users to perform basic CRUD operations (Create, Read, Update, Delete) on a contact list stored in a >JSON file. The application is built using Node.js and leverages popular npm packages such as
yargs
andcommander
for parsing command-line arguments.
- List all contacts: View the entire contact list in a table format.
- Retrieve a contact: Search for a contact by their unique ID.
- Add a new contact: Add a contact with a name, email, and phone number.
- Remove a contact: Delete a contact from the list using their unique ID.
- JSON storage: Contacts are stored persistently in a
contacts.json
file located in thedb
folder. - Modular design: Functions for contact management are encapsulated in a separate
contacts.js
module.
- Node.js: JavaScript runtime environment.
- yargs: For parsing command-line arguments.
- commander: An alternative package for CLI argument parsing.
- fs and path modules: For file system operations and path handling.
cli-contact-manager/
├── db/
│ └── contacts.json # Stores the contact data
├── index.js # Main entry point for the CLI
├── contacts.js # Module for managing contact operations
├── package.json # Project configuration and dependencies
├── README.md # Project documentation