A simple Command-Line Interface (CLI) To-Do List application written in Go. The app uses flags to parse inputs, stores the to-do lists in a JSON file, and displays lists in a clean tabular format.
- Add a new to-do with a specified title.
- Delete a to-do by its index.
- Edit a to-do by specifying its index and a new title.
- List all to-dos in a tabular format with details like creation and completion times.
- Toggle the completion status of a to-do by index.
- Data persistence through JSON for storing and managing to-dos.
- Displays to-dos using a formatted table (via github.com/aquasecurity/table).
-
Clone the repository:
git clone https://github.com/Wambita/cli-to-to-list.git cd cli-to-to-list
-
Install dependencies:
go mod tidy
-
Build the application:
go build -o todo
-
Run the application:
./todo
Run the todo
executable with the following flags to manage your to-do list:
./todo -Add "Buy groceries"
./todo -Del 1
./todo -Edit "1:Go for a walk"
./todo -List
Example Output:
┌───┬───────────┬───────────┬───────────────────────────────┬───────────────────────────────┐
│ # │ Title │ Completed │ Created At │ Completed At │
├───┼───────────┼───────────┼───────────────────────────────┼───────────────────────────────┤
│ 0 │ Buy bread │ ❌ │ Sun, 26 Jan 2025 18:39:37 EAT │ │
│ 1 │ Buy milk │ ✅ │ Sun, 26 Jan 2025 18:40:10 EAT │ Sun, 26 Jan 2025 18:42:05 EAT │
│ 2 │ Walk │ ❌ │ Sun, 26 Jan 2025 19:08:57 EAT │ │
└───┴───────────┴───────────┴───────────────────────────────┴───────────────────────────────┘
./todo -toggle 2
- Go Programming Language
- JSON for data persistence
- github.com/aquasecurity/table for displaying to-dos in a tabular format
While developing this project, I gained hands-on experience with:
- JSON marshalling and unmarshalling
- Date and time handling
- Pointers, structs, and generics
- Constructors and string manipulation
- Parsing CLI flags
Contributions are welcome! To contribute:
- Fork this repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add some feature"
- Push to the branch:
git push origin feature-name
- Open a pull request.
Wambita Sheila Fana
GitHub: Wambita
Happy task management! 🚀