This commit is contained in:
2025-05-23 00:00:44 -04:00
5 changed files with 106 additions and 57 deletions

16
Formula/todo.rb Normal file
View File

@@ -0,0 +1,16 @@
class Todo < Formula
desc "A simple CLI todo application written in Go"
homepage "https://github.com/AmanTahiliani/todo"
version "0.1.0"
license "MIT"
depends_on "go" => :build
def install
system "go", "build", "-o", bin/"todo", "./cmd/todo"
end
test do
system "#{bin}/todo", "--help"
end
end

23
Makefile Normal file
View File

@@ -0,0 +1,23 @@
BINARY_NAME=todo
INSTALL_PATH=/usr/local/bin
.PHONY: build
build:
go build -o $(BINARY_NAME) ./cmd/todo
.PHONY: install
install: build
mkdir -p $(INSTALL_PATH)
cp $(BINARY_NAME) $(INSTALL_PATH)/$(BINARY_NAME)
.PHONY: uninstall
uninstall:
rm -f $(INSTALL_PATH)/$(BINARY_NAME)
.PHONY: clean
clean:
rm -f $(BINARY_NAME)
.PHONY: test
test:
go test -v ./...

122
README.md
View File

@@ -1,6 +1,6 @@
# Go Todo CLI App # Todo CLI
A simple command-line Todo application written in Go. Todos are stored in a SQLite database. A powerful command-line todo application written in Go. Manage your tasks efficiently with a simple, intuitive interface. All data is automatically stored in a SQLite database in your home directory.
## Features ## Features
@@ -8,77 +8,87 @@ A simple command-line Todo application written in Go. Todos are stored in a SQLi
- List all todos, grouped by incomplete and completed - List all todos, grouped by incomplete and completed
- Mark todos as completed - Mark todos as completed
- Remove todos by ID - Remove todos by ID
- Data is persisted in SQLite database - Automatic SQLite database management
- User-friendly command-line interface with action commands - User-friendly command-line interface with intuitive commands
- Data stored securely in user's home directory
## Dependencies ## Installation
- Go 1.x ### Using Go
- github.com/mattn/go-sqlite3
```bash
go install github.com/AmanTahiliani/todo/cmd/todo@latest
```
### Using Make
```bash
git clone https://github.com/AmanTahiliani/todo.git
cd todo
make install
```
### Using Homebrew (macOS)
```bash
brew tap AmanTahiliani/todo
brew install todo
```
## Usage ## Usage
Build the app: ### Add a new todo
```bash
```sh todo add -t "Meeting" -d "Team standup at 10AM"
go build -o todo
``` ```
### Command Structure ### List all todos
```bash
The app uses a command-based interface where the action comes first, followed by flags: todo list
```sh
./todo [action] [flags]
``` ```
Available actions: ### Mark a todo as completed
- `add` - Add a new todo item ```bash
- `remove` - Remove a todo item todo complete -i 1
- `complete` - Mark a todo item as completed
- `list` - List all todo items
### Flags
- `-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
### Examples
Add a new todo:
```sh
./todo add -t "Buy milk" -d "Get 2 liters of milk"
``` ```
List all todos: ### Remove a todo
```sh ```bash
./todo list todo remove -i 1
``` ```
Complete a todo: ### Get help
```sh ```bash
./todo complete -i 1 todo --help
``` ```
Remove a todo: ## Data Storage
```sh
./todo remove -i 2 Todos are automatically stored in a SQLite database located at `~/.todo/todos.db`. The application handles all database operations transparently, so you don't need to worry about database management.
## Development
### Prerequisites
- Go 1.21 or later
- Make (optional, for easier building)
### Building from source
```bash
make build
``` ```
Display help: ### Running tests
```sh
./todo -h ```bash
make test
``` ```
## Next Improvements ## License
- Use a CLI library like [cobra](https://github.com/spf13/cobra) for better UX MIT License
- Add edit and search features
- Add unit tests ## Contributing
- Improve error handling
- Add binary release for different platforms and make it available through Homebrew, Winget and Apt Contributions are welcome! Please feel free to submit a Pull Request.
- Add due dates and priority levels for todos
- Implement categories/tags for better organization
- Add data export/import functionality

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/AmanTahiliani/todo module github.com/AmanTahiliani/todo
go 1.24.0 go 1.21.4
require ( require (
github.com/mattn/go-sqlite3 v1.14.28 github.com/mattn/go-sqlite3 v1.14.28

BIN
todo

Binary file not shown.