Skip to content

eshan-one/go-task-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Tracker CLI

A simple command-line tool, written in Go, for tracking tasks and managing your to-do list. Built as a solution to the Task Tracker backend project on roadmap.sh.

Tasks are stored locally in a tasks.json file — no database, no server, no external dependencies. Just the Go standard library.

Task Tracker CLI demo


Features

  • Add, update, and delete tasks
  • Mark a task as todo, in-progress, or done
  • List all tasks, or filter by status
  • Data persists between runs in a plain JSON file
  • Zero external dependencies — pure Go standard library

Prerequisites

  • Go 1.22 or later installed
  • Verify with:
    go version

Getting started

Option A: Install directly (no cloning required)

Since this project is a proper Go module, you can install the task-cli binary straight from GitHub with a single command — no need to clone the repo first:

go install github.com/<your-username>/task-tracker-cli@latest

This downloads, builds, and places the task-cli binary in your $GOPATH/bin (usually ~/go/bin). Make sure that folder is on your PATH:

export PATH="$PATH:$(go env GOPATH)/bin"

Add that line to your ~/.zshrc or ~/.bashrc to make it permanent. Once installed, you can run task-cli from anywhere:

task-cli add "Buy groceries"
task-cli list

Option B: Clone the repository

git clone https://github.com/<your-username>/task-tracker-cli.git
cd task-tracker-cli

Then build it:

go build -o task-cli

This produces an executable called task-cli (task-cli.exe on Windows) in the project folder.

Run it:

./task-cli add "Buy groceries"

On Windows use task-cli.exe instead of ./task-cli, or run directly without building:

go run . add "Buy groceries"

Usage

# Add a new task
./task-cli add "Buy groceries"
# Task added successfully (ID: 1)

# Update a task's description
./task-cli update 1 "Buy groceries and cook dinner"

# Delete a task
./task-cli delete 1

# Mark a task's status
./task-cli mark-in-progress 1
./task-cli mark-done 1

# List tasks
./task-cli list                # all tasks
./task-cli list done           # only done
./task-cli list todo           # only todo
./task-cli list in-progress    # only in-progress

Each task is stored with an id, description, status, createdAt, and updatedAt timestamp inside tasks.json in the current directory.


Verifying the project works

  1. Build succeeds without errors:
    go build -o task-cli
  2. Basic flow works end to end:
    ./task-cli add "Test task"
    ./task-cli list
    You should see Task added successfully (ID: 1) followed by the task listed as todo.
  3. Data actually persists — open tasks.json in the project folder and confirm the task appears there with the correct fields.
  4. Status updates work:
    ./task-cli mark-done 1
    ./task-cli list done
    The task should now appear in the done filter.
  5. Error handling works (should print a clear error, not crash):
    ./task-cli update 99 "no such task"
    ./task-cli delete 99
    ./task-cli mark-done abc
    ./task-cli
  6. (If included) Automated tests pass:
    go test ./... -v

If all of the above behave as described, the project is working correctly.


Project structure

task-tracker-cli/
├── go.mod
├── main.go        # CLI argument parsing and command routing
├── task.go        # Task struct + business logic (add/update/delete/mark/list)
├── storage.go     # Reading/writing tasks.json
├── assets/
│   └── demo-terminal.png
└── tasks.json     # created automatically at runtime (not committed)

License

Feel free to use this project for learning purposes.

About

A simple command-line task tracker built with Go for managing tasks efficiently.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages