A simple command-line Todo list application written in Go. This CLI app allows you to manage your tasks by adding, completing, deleting, and listing todos. The todos are stored in a local .todo.json
file.
- Add a new task: Add a new todo to the list.
- Mark a task as completed: Mark a specific todo by its index as completed.
- Delete a task: Delete a todo by its index.
- List all tasks: View all your tasks, including their statuses.
- Go 1.18 or higher installed on your system.
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/go-todo-cli.git cd go-todo-cli
-
Build the app:
go build -o todo-cli
This will generate an executable file named
todo-cli
.
To add a new todo task, use the --add
flag followed by the task description. If you don't provide the task description as a flag argument, you will be prompted to enter it.
./todo-cli --add "Buy groceries"
To mark a todo as completed, use the --complete
flag followed by the index of the task you want to complete. For example, to complete the first task:
./todo-cli --complete 1
To delete a task, use the --del
flag followed by the index of the task to delete:
./todo-cli --del 2
To view all tasks and their statuses, use the --list
flag:
./todo-cli --list
Todos are saved in the .todo.json
file in the same directory. Each task includes a description and a status (completed or not).
- If a task description is empty when adding a new task, an error will be thrown.
- If the index provided for completing or deleting a task is invalid, an error will be thrown.
-
Add a new task:
./todo-cli --add "Complete Go project"
-
List tasks:
./todo-cli --list
-
Complete the task:
./todo-cli --complete 1
-
List tasks again:
./todo-cli --list
-
Delete a task:
./todo-cli --del 1