This is a simple Todo Command Line Interface (CLI) application written in Go. It allows users to manage their tasks efficiently by adding, editing, toggling, deleting, and listing todos directly from the terminal.
- Add a Todo: Add a new todo with a title.
- Edit a Todo: Edit an existing todo by specifying its index and the new title.
- Delete a Todo: Remove a todo by its index.
- Toggle Completion: Mark a todo as completed or incomplete by toggling its status.
- List Todos: Display a formatted list of all todos with details like title, completion status, creation date, and completion date.
- Go (version 1.16 or higher)
- Clone the repository:
git clone cd todo
- Build the application:
go build -o todo
Run the application using the go run
command or the compiled binary. Below are the supported commands:
./todo --list
Displays all todos in a formatted table.
./todo -add "<title>"
Adds a new todo with the specified title.
Example:
./todo -add "Go for a walk"
./todo -edit <index>:<new_title>
Edits the todo at the specified index and updates the title.
Example:
./todo -edit 0:"Read a book"
./todo -toggle <index>
Toggles the completion status of the todo at the specified index.
Example:
./todo -toggle 0
./todo -del <index>
Deletes the todo at the specified index.
Example:
./todo -del 0
Adding a todo:
./todo -add "Go for a walk"
Listing todos:
./todo --list
┌───┬───────────────┬───────────┬───────────────────────────────┬──────────────┐
│ # │ Title │ Completed │ Created At │ Completed At │
├───┼───────────────┼───────────┼───────────────────────────────┼──────────────┤
│ 0 │ Go for a walk │ ❌ │ Mon, 27 Jan 2025 21:05:03 PKT │ │
└───┴───────────────┴───────────┴───────────────────────────────┴──────────────┘
Toggling a todo:
./todo -toggle 0
Deleting a todo:
./todo -del 0
- Invalid commands or arguments will display an appropriate error message.
- For editing, the format must be
index:new_title
, e.g.,0:New Title
. An error will be shown if the format is incorrect.