A command-line interface (CLI) application to track and manage your tasks and to-do list. Built with Go and Cobra.
Project URL: https://roadmap.sh/projects/task-tracker
- ✅ Add, Update, and Delete tasks
- ✅ Mark a task as in progress or done
- ✅ List all tasks
- ✅ List tasks by status (todo, in-progress, done)
- ✅ Data persistence using JSON file storage
Each task contains the following properties:
| Property | Description |
|---|---|
id |
A unique identifier for the task |
description |
A short description of the task |
status |
The status of the task (todo, in-progress, done) |
createdAt |
The date and time when the task was created |
updatedAt |
The date and time when the task was last updated |
Task Tracker CLI is built with:
- Go - Programming language
- Cobra - CLI framework for Go
- JSON file storage - Tasks are persisted in a local
data.jsonfile
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ CLI Commands │────▶│ Helper Layer │────▶│ data.json │
│ (cmd/*.go) │ │ (helper/*.go) │ │ (storage) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- Commands (
cmd/) - Define CLI commands using Cobra (add, list, update, delete, etc.) - Helper (
helper/) - Handles data structures and JSON file read/write operations - Storage - Tasks are stored in
data.jsonin the current directory
- Go 1.25+ installed on your system
go install github.com/plh97/task-cli@latest# Clone the repository
git clone https://github.com/plh97/task-cli.git
cd task-cli
# Build the binary
go build -o task-cli .
# (Optional) Move to your PATH for global access
sudo mv task-cli /usr/local/bin/Download pre-built binaries from the Releases page.
# If installed via go install or moved to PATH
task-cli add "My first task"
task-cli list
# If running from source directory
go run . add "My first task"
go run . listtask-cli add "Buy groceries"
# Output: Task added successfully (ID: 1)task-cli update 1 "Buy groceries and cook dinner"task-cli delete 1# Mark a task as in progress
task-cli mark-in-progress 1
# Mark a task as done
task-cli mark-done 1# List all tasks
task-cli list
# List tasks by status
task-cli list done
task-cli list todo
task-cli list in-progressTasks are stored in a data.json file in the current directory. The file is automatically created if it does not exist.
Example data.json structure:
{
"data": [
{
"id": "abc123",
"description": "Buy groceries",
"status": "todo",
"created_at": "2026-01-18T10:00:00Z",
"updated_at": "2026-01-18T10:00:00Z"
}
]
}task-cli/
├── cli_cobra_basic.go # Main entry point
├── cmd/
│ ├── root.go # Root command configuration
│ └── add.go # Add task command
├── helper/
│ └── helper.go # Data structures and file operations
├── data.json # Task storage (auto-generated)
├── go.mod
└── README.md# Clone the repository
git clone https://github.com/plh97/task-cli.git
cd task-cli
# Install dependencies
go mod download
# Run in development mode
go run . <command>- Create a new file in
cmd/directory (e.g.,cmd/mycommand.go) - Define your command using Cobra:
package cmd
import "github.com/spf13/cobra"
var myCmd = &cobra.Command{
Use: "mycommand",
Short: "Description of my command",
Run: func(cmd *cobra.Command, args []string) {
// Your logic here
},
}
func init() {
rootCmd.AddCommand(myCmd)
}# Build for current platform
go build -o task-cli .
# Build for multiple platforms
GOOS=darwin GOARCH=arm64 go build -o task-cli-darwin-arm64 .
GOOS=linux GOARCH=amd64 go build -o task-cli-linux-amd64 .
GOOS=windows GOARCH=amd64 go build -o task-cli-windows-amd64.exe .go test ./...MIT License
Contributions are welcome! Please feel free to submit a Pull Request.