Skip to content

Command-line to-do list manager. It lets users add, delete, edit, and mark tasks as complete. The data is saved to a JSON file.

Notifications You must be signed in to change notification settings

ybrodsky-rh/ToDoListApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ To-Do List App

A simple, efficient command-line to-do list manager built with Go. Manage your tasks directly from the terminal with an intuitive interface. This project was based on the following YouTube tutorial: "How to Build A CLI Todo App in Go" by Coding with Patrik. Link: https://www.youtube.com/watch?v=g16Zf0KQEWI It is intended for learning purposes.

✨ Features

  • βœ… Add tasks - Quickly add new to-do items with priority levels
  • πŸ—‘οΈ Delete tasks - Remove completed or unwanted tasks
  • ✏️ Edit tasks - Update task titles anytime
  • βœ”οΈ Toggle completion - Mark tasks as done/undone with timestamps
  • 🎯 Priority levels - Categorize tasks as Low, Medium, or High priority
  • 🏷️ Tags/Categories - Organize tasks with custom tags
  • πŸ“… Due dates - Set deadlines for your tasks with reminders
  • πŸ” Search functionality - Find tasks by title
  • 🏷️ Filter by tags - View tasks by category
  • πŸ“Š Statistics - See task completion progress and priority breakdown
  • πŸ”„ Sorting - Sort tasks by priority or creation date
  • πŸ’Ύ Persistent storage - All tasks saved to JSON file
  • πŸ“Š Beautiful CLI table - View all tasks in a colored, formatted table
  • 🎨 Color-coded output - Priorities and completion status shown with colors

πŸš€ Getting Started

Prerequisites

  • Go 1.18 or higher installed on your machine

Installation

  1. Clone the repository:
git clone https://github.com/ybrodsky-rh/ToDoListApp.git
cd ToDoListApp
  1. Install dependencies:
go mod download
  1. Build the application:
go build

πŸ“– Usage

Add a Task (Basic)

./ToDoListApp -add "Buy groceries"
./ToDoListApp -add "Finish project report"

Add a Task (With Priority, Tags & Due Date)

./ToDoListApp -add "Learn Go" -priority "High" -tags "learning,golang" -due "2026-01-20"
./ToDoListApp -add "Buy groceries" -priority "Low" -tags "shopping,home"
./ToDoListApp -add "Project deadline" -priority "High" -tags "work" -due "2026-01-25"

List All Tasks

./ToDoListApp -list

Shows all tasks in a colored table with priorities, due dates, and task statistics.

Search Tasks by Title

./ToDoListApp -search "Go"

Finds all tasks containing the search term (case-insensitive).

Filter Tasks by Tag

./ToDoListApp -tag "work"
./ToDoListApp -tag "home"

View Statistics

./ToDoListApp -stats

Displays: Total tasks, Completed, Pending, and High Priority count.

Sort Tasks

./ToDoListApp -sort "priority"  # Sort by priority (High β†’ Medium β†’ Low)
./ToDoListApp -sort "date"      # Sort by creation date (oldest first)

Toggle Task Completion

./ToDoListApp -toggle 0

Delete a Task

./ToDoListApp -del 0

Edit a Task

./ToDoListApp -edit "0:Updated task title"

πŸ“‚ Project Structure

ToDoListApp/
β”œβ”€β”€ main.go          # Entry point of the application
β”œβ”€β”€ todo.go          # Todo struct and operations (add, delete, toggle, etc.)
β”œβ”€β”€ command.go       # Command-line flag parsing
β”œβ”€β”€ storage.go       # JSON file I/O operations
β”œβ”€β”€ go.mod           # Go module definition
β”œβ”€β”€ go.sum           # Dependency checksums
β”œβ”€β”€ todos.json       # Persistent storage file (auto-generated)
└── README.md        # This file

πŸ”§ How It Works

  1. Load - Reads existing todos from todos.json
  2. Parse - Parses command-line flags (-add, -del, -toggle, -edit, -list, -search, -tag, -sort, -stats, etc.)
  3. Execute - Performs the requested operation
  4. Save - Persists changes back to todos.json

πŸ“‹ Available CLI Flags

Flag Description Example
-add Add a new task -add "Buy milk"
-priority Set priority level -priority "High" (Low, Medium, High)
-tags Add tags (comma-separated) -tags "work,urgent,learning"
-due Set due date -due "2026-01-20" (YYYY-MM-DD)
-list List all tasks -list
-search Search by title -search "golang"
-tag Filter by tag -tag "work"
-sort Sort tasks -sort "priority" or -sort "date"
-stats Show statistics -stats
-toggle Mark as complete/incomplete -toggle 0
-edit Edit task title -edit "0:New title"
-del Delete a task -del 0

πŸ’‘ Key Go Concepts Used

  • Pointers (*) - Modify original data in methods
  • Methods - Functions attached to types using receivers
  • Generics ([T any]) - Flexible Storage type for any data
  • Error Handling - Proper error returns and validation
  • JSON marshaling - Serialize/deserialize data
  • Slices - Dynamic arrays for managing todos
  • Type constants - Custom Priority type and color constants
  • Sorting - Using sort.Slice() for custom sorting logic
  • String manipulation - Parsing dates, tags, and search queries

πŸ“¦ Dependencies

πŸ› οΈ Development

Running Tests (if applicable)

go test ./...

Modifying Dependencies

go mod tidy

πŸ“ Example Workflow

# Add some tasks with different priorities
./ToDoListApp -add "Learn Go basics" -priority "High" -tags "learning,golang" -due "2026-01-20"
./ToDoListApp -add "Build a CLI project" -priority "High" -tags "work,golang"
./ToDoListApp -add "Buy groceries" -priority "Low" -tags "shopping,home"
./ToDoListApp -add "Code review" -priority "Medium" -tags "work"

# View all tasks with colors and statistics
./ToDoListApp -list

# Search for specific tasks
./ToDoListApp -search "Go"

# Filter tasks by tag
./ToDoListApp -tag "work"
./ToDoListApp -tag "shopping"

# Sort tasks by priority
./ToDoListApp -sort "priority"

# View quick statistics
./ToDoListApp -stats

# Mark first task as done
./ToDoListApp -toggle 0

# Edit a task
./ToDoListApp -edit "1:Completed my first project"

# Delete a task
./ToDoListApp -del 2

# View updated list
./ToDoListApp -list

Output Example

When you run -list, you'll see:

β”Œβ”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ # β”‚        Title            β”‚ Priority β”‚ Completed β”‚ Created At β”‚  Due Date  β”‚
β”œβ”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 0 β”‚ Learn Go basics          β”‚ High     β”‚ βœ…        β”‚ 2026-01-11 β”‚ 2026-01-20 β”‚
β”‚ 1 β”‚ Build a CLI project      β”‚ High     β”‚ ❌        β”‚ 2026-01-11 β”‚            β”‚
β”‚ 2 β”‚ Buy groceries            β”‚ Low      β”‚ ❌        β”‚ 2026-01-11 β”‚            β”‚
β”‚ 3 β”‚ Code review              β”‚ Medium   β”‚ ❌        β”‚ 2026-01-11 β”‚            β”‚
β””β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“Š Task Statistics:
   Total: 4 | Completed: 1 | Pending: 3 | High Priority: 2

⏰ Due Today:
   Nothing due today! πŸŽ‰

πŸŽ“ Learning Resource

This project is great for learning:

  • Go fundamentals (structs, methods, receivers)
  • Command-line argument parsing with the flag package
  • File I/O and JSON handling (marshaling/unmarshaling)
  • Generic types (Go 1.18+)
  • Error handling patterns
  • Custom type definitions and constants
  • Sorting and searching algorithms
  • Working with time/date handling
  • Building practical CLI applications

πŸ“„ License

This project is open source and available under the MIT License.

🀝 Contributing

Feel free to fork this repository and submit pull requests for any improvements!

πŸ“§ Contact

For questions or suggestions, please open an issue on GitHub.


Happy task managing! πŸš€

About

Command-line to-do list manager. It lets users add, delete, edit, and mark tasks as complete. The data is saved to a JSON file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages