mirror of
https://github.com/AmanTahiliani/todo.git
synced 2026-08-07 11:54:14 -04:00
Made Production Ready
This commit is contained in:
16
Formula/todo.rb
Normal file
16
Formula/todo.rb
Normal 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
23
Makefile
Normal 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
122
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
|
## 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
|
|
||||||
|
|||||||
12
go.mod
12
go.mod
@@ -1,5 +1,13 @@
|
|||||||
module github.com/AmanTahiliani/todo
|
module github.com/AmanTahiliani/todo
|
||||||
|
|
||||||
go 1.24.0
|
go 1.21.4
|
||||||
|
|
||||||
require github.com/mattn/go-sqlite3 v1.14.28
|
require (
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.28
|
||||||
|
github.com/spf13/cobra v1.9.1
|
||||||
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
|
github.com/spf13/pflag v1.0.6 // indirect
|
||||||
|
)
|
||||||
|
|||||||
10
go.sum
10
go.sum
@@ -1,2 +1,12 @@
|
|||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
|
||||||
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
|
||||||
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
|
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||||
|
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
|
||||||
|
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
|
||||||
|
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
|
||||||
|
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
|
|||||||
Reference in New Issue
Block a user