diff --git a/Formula/todo.rb b/Formula/todo.rb new file mode 100644 index 0000000..616e73b --- /dev/null +++ b/Formula/todo.rb @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..477006b --- /dev/null +++ b/Makefile @@ -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 ./... \ No newline at end of file diff --git a/README.md b/README.md index 5d0d780..37fd125 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 - Mark todos as completed - Remove todos by ID -- Data is persisted in SQLite database -- User-friendly command-line interface with action commands +- Automatic SQLite database management +- User-friendly command-line interface with intuitive commands +- Data stored securely in user's home directory -## Dependencies +## Installation -- Go 1.x -- github.com/mattn/go-sqlite3 +### Using Go + +```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 -Build the app: - -```sh -go build -o todo +### Add a new todo +```bash +todo add -t "Meeting" -d "Team standup at 10AM" ``` -### Command Structure - -The app uses a command-based interface where the action comes first, followed by flags: - -```sh -./todo [action] [flags] +### List all todos +```bash +todo list ``` -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 - -### 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" +### Mark a todo as completed +```bash +todo complete -i 1 ``` -List all todos: -```sh -./todo list +### Remove a todo +```bash +todo remove -i 1 ``` -Complete a todo: -```sh -./todo complete -i 1 +### Get help +```bash +todo --help ``` -Remove a todo: -```sh -./todo remove -i 2 +## Data Storage + +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: -```sh -./todo -h +### Running tests + +```bash +make test ``` -## Next Improvements +## License -- 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 -- Add binary release for different platforms and make it available through Homebrew, Winget and Apt -- Add due dates and priority levels for todos -- Implement categories/tags for better organization -- Add data export/import functionality +MIT License + +## Contributing + +Contributions are welcome! Please feel free to submit a Pull Request. diff --git a/go.mod b/go.mod index 3a39d03..62c6992 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/AmanTahiliani/todo -go 1.24.0 +go 1.21.4 require ( github.com/mattn/go-sqlite3 v1.14.28 diff --git a/todo b/todo index 45a2111..aa7871f 100755 Binary files a/todo and b/todo differ