|
1 | | -todo-cli/ |
2 | | -├── cmd/ |
3 | | -│ └── root.go # Entry point CLI command handlers |
4 | | -├── todo/ |
5 | | -│ ├── task.go # Task struct and helpers |
6 | | -│ ├── manager.go # Add, List, Done, Delete logic (pure functions) |
7 | | -│ ├── storage.go # Load/Save to JSON file |
8 | | -│ ├── task_test.go # Unit tests for task logic |
9 | | -│ ├── manager_test.go # Unit tests for business logic |
10 | | -│ └── storage_test.go # Unit tests for file I/O (can be mocked) |
11 | | -├── tasks.json # File to store tasks (auto-created) |
12 | | -├── go.mod |
13 | | -├── main.go # Main entry — delegates to cmd/root.go |
14 | | -└── README.md # Project instructions |
| 1 | +# 📝 To-Do CLI Application in Go |
| 2 | + |
| 3 | +A simple and testable **Command Line To-Do List App** written in Go using clean architecture. It supports adding, listing, completing, and deleting tasks directly from your terminal. |
| 4 | + |
| 5 | +This app is built for learning and demonstrating: |
| 6 | + |
| 7 | +- Go programming best practices |
| 8 | +- Modular code structure |
| 9 | +- Unit testing |
| 10 | +- File-based persistence |
| 11 | +- CLI design with Cobra (planned) |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## 🚀 Features |
| 16 | + |
| 17 | +- ✅ Add new tasks |
| 18 | +- 📋 List all tasks (sorted by ID) |
| 19 | +- ✅ Mark tasks as completed |
| 20 | +- ❌ Delete tasks |
| 21 | +- 💾 Persist tasks to local JSON file |
| 22 | +- 🧪 Unit tested using Go’s `testing` package |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## 🧱 Tech Stack |
| 27 | + |
| 28 | +| Component | Tech | |
| 29 | +| ------------ | -------------------------- | |
| 30 | +| Language | Go 1.21+ | |
| 31 | +| CLI Parser | Cobra _(coming soon)_ | |
| 32 | +| File Storage | Local JSON File | |
| 33 | +| Testing | Built-in `testing` package | |
| 34 | +| CI/CD | GitHub Actions (Go CI) | |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +## 📁 Project Structure |
| 39 | + |
| 40 | +``` |
| 41 | +to_do_cli/ |
| 42 | +├── cmd/ # (optional) Cobra CLI commands |
| 43 | +├── todo/ # Core business logic and models |
| 44 | +│ ├── task.go |
| 45 | +│ ├── manager.go |
| 46 | +│ ├── storage.go |
| 47 | +│ ├── *_test.go |
| 48 | +├── main.go # Entry point (delegates to cmd or logic) |
| 49 | +├── tasks.json # File for persisting task data |
| 50 | +├── go.mod # Go module definition |
| 51 | +├── README.md # Project overview and usage |
| 52 | +└── .github/workflows/ # GitHub Actions CI pipeline |
| 53 | +``` |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## 🧪 Running Tests |
| 58 | + |
| 59 | +```bash |
| 60 | +go test ./... |
| 61 | +``` |
| 62 | + |
| 63 | +Or run with verbose output: |
| 64 | + |
| 65 | +```bash |
| 66 | +go test -v ./... |
| 67 | +``` |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +## 🤝 Contributing |
| 72 | + |
| 73 | +Feel free to fork and contribute! This project is open for improvements, experimentation, and learning. |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## 📄 License |
| 78 | + |
| 79 | +MIT |
0 commit comments