Skip to content

๐Ÿ“Ÿ Expense Tracker, simple command-Line Interface (CLI) tool for tracking and managing personal expenses.

License

Notifications You must be signed in to change notification settings

fhasnur/expense-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

13 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Expense Tracker CLI

A Command-Line Interface (CLI) tool for tracking and managing personal expenses. It allows users to add expenses, delete records, view expense history, and generate summaries. The sample solution for the expense-tracker challenge from roadmap.sh.

Installation

To use the Expense Tracker CLI, you need to have Go installed on your machine.

Clone the Repository:

git clone https://github.com/fhasnur/expense-tracker.git

Navigate to the project directory:

cd expense-tracker

Install the required Go modules::

go mod tidy

Build the CLI:

go build -o task-cli

Usage

Once built, you can run the CLI tool from your terminal. Below are the example commands:

Add an Expense

./expense-tracker add --description "Lunch" --amount 20
# Expense added successfully (ID: 1)

List All Expenses

./expense-tracker list
# ID  | Date/Time            | Description     | Amount
# -------------------------------------------------------
# 1   | 2024-09-24 23:06     | Lunch           | $20
# 2   | 2024-09-30 18:31     | Dinner          | $10
# 3   | 2024-10-02 18:58     | Shopping        | $30

Delete an Expense

./expense-tracker delete --id 1
# Expense deleted successfully

View Expenses Summary

./expense-tracker summary
# Total expenses: $60

Summary for a Specific Month

./expense-tracker summary --month 10
# Total expenses for October: $30

File Structure

Expenses are stored in a JSON file located at expenses.json in the root folder. Each expense entry is structured as follows:

{
  "id": 1,
  "description": "Lunch",
  "amount": 20,
  "created_at": "2024-09-24T23:06:02.7613895+07:00",
  "updated_at": "2024-09-24T23:06:02.7613895+07:00"
}

Contributing

Feel free to submit pull requests or open issues for new features, improvements, or bug fixes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

๐Ÿ“Ÿ Expense Tracker, simple command-Line Interface (CLI) tool for tracking and managing personal expenses.

Topics

Resources

License

Stars

Watchers

Forks

Languages