2025-05-21 00:35:51 -04:00
|
|
|
# Go Todo CLI App
|
|
|
|
|
|
2025-05-22 23:15:24 -04:00
|
|
|
A simple command-line Todo application written in Go. Todos are stored in a SQLite database.
|
2025-05-21 00:35:51 -04:00
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
|
|
- Add new todos with a title and description
|
|
|
|
|
- List all todos, grouped by incomplete and completed
|
|
|
|
|
- Mark todos as completed
|
|
|
|
|
- Remove todos by ID
|
2025-05-22 23:15:24 -04:00
|
|
|
- Data is persisted in SQLite database
|
2025-05-22 23:25:53 -04:00
|
|
|
- User-friendly command-line interface with action commands
|
2025-05-22 23:15:24 -04:00
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
|
|
- Go 1.x
|
|
|
|
|
- github.com/mattn/go-sqlite3
|
2025-05-21 00:35:51 -04:00
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
Build the app:
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
go build -o todo
|
|
|
|
|
```
|
|
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
### Command Structure
|
|
|
|
|
|
|
|
|
|
The app uses a command-based interface where the action comes first, followed by flags:
|
2025-05-21 00:35:51 -04:00
|
|
|
|
|
|
|
|
```sh
|
2025-05-22 23:25:53 -04:00
|
|
|
./todo [action] [flags]
|
2025-05-21 00:35:51 -04:00
|
|
|
```
|
|
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
Available actions:
|
|
|
|
|
- `add` - Add a new todo item
|
|
|
|
|
- `remove` - Remove a todo item
|
|
|
|
|
- `complete` - Mark a todo item as completed
|
|
|
|
|
- `list` - List all todo items
|
2025-05-21 00:35:51 -04:00
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
### Flags
|
2025-05-21 00:35:51 -04:00
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
- `-t, --title` - Title for the todo (required for add)
|
|
|
|
|
- `-d, --description` - Description for the todo (required for add)
|
|
|
|
|
- `-i, --id` - ID of the todo (required for remove and complete)
|
|
|
|
|
- `-h, --help` - Display help information
|
2025-05-21 00:35:51 -04:00
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
### Examples
|
|
|
|
|
|
|
|
|
|
Add a new todo:
|
2025-05-21 00:35:51 -04:00
|
|
|
```sh
|
2025-05-22 23:25:53 -04:00
|
|
|
./todo add -t "Buy milk" -d "Get 2 liters of milk"
|
2025-05-21 00:35:51 -04:00
|
|
|
```
|
|
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
List all todos:
|
2025-05-21 00:35:51 -04:00
|
|
|
```sh
|
2025-05-22 23:25:53 -04:00
|
|
|
./todo list
|
2025-05-21 00:35:51 -04:00
|
|
|
```
|
|
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
Complete a todo:
|
|
|
|
|
```sh
|
|
|
|
|
./todo complete -i 1
|
|
|
|
|
```
|
2025-05-21 00:35:51 -04:00
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
Remove a todo:
|
|
|
|
|
```sh
|
|
|
|
|
./todo remove -i 2
|
|
|
|
|
```
|
2025-05-21 00:35:51 -04:00
|
|
|
|
2025-05-22 23:25:53 -04:00
|
|
|
Display help:
|
2025-05-21 00:35:51 -04:00
|
|
|
```sh
|
2025-05-22 23:25:53 -04:00
|
|
|
./todo -h
|
2025-05-21 00:35:51 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Next Improvements
|
|
|
|
|
|
|
|
|
|
- Use a CLI library like [cobra](https://github.com/spf13/cobra) for better UX
|
|
|
|
|
- Add edit and search features
|
|
|
|
|
- Add unit tests
|
|
|
|
|
- Improve error handling
|
2025-05-22 23:15:24 -04:00
|
|
|
- Add binary release for different platforms and make it available through Homebrew, Winget and Apt
|
2025-05-22 23:25:53 -04:00
|
|
|
- Add due dates and priority levels for todos
|
|
|
|
|
- Implement categories/tags for better organization
|
|
|
|
|
- Add data export/import functionality
|