main
gator
A blog aggregator CLI built as part of the boot.dev course. Follow RSS feeds and browse their latest posts right from your terminal.
Requirements
Before you can run gator you'll need to have the following installed:
- Go (1.26 or newer)
- PostgreSQL (a running server, local or remote)
Installation
Install the gator CLI with go install:
go install github.com/StevanFreeborn/gator@latest
The binary is placed in $(go env GOPATH)/bin. Make sure that directory is on your PATH:
export PATH="$(go env GOPATH)/bin:$PATH"
Setup
1. Create a database
Create a database for gator in your Postgres server:
createdb gator
The schema is managed with goose migrations in sql/schema. Install goose and apply the migrations:
go install github.com/pressly/goose/v3/cmd/goose@latest
goose -dir sql/schema postgres "postgres://<user>:<password>@localhost:5432/gator?sslmode=disable" up
2. Create the config file
gator reads its configuration from ~/.gatorconfig.json. Create that file with the connection string for your database:
{
"db_url": "postgres://<user>:<password>@localhost:5432/gator?sslmode=disable",
"current_user_name": ""
}
Usage
Run gator with gator <command> <args>. Start by registering a user, then log in:
gator register myusername
gator login myusername
A few commands you can run:
| Command | Description |
|---|---|
gator register <name> |
Register a new user and log in as them |
gator login <name> |
Log in as an existing user |
gator users |
List all registered users |
gator addfeed <name> <url> |
Add an RSS feed and follow it |
gator feeds |
List all feeds |
gator follow <name-or-url> |
Follow a feed by name or url |
gator following |
List the feeds you're following |
gator unfollow <name-or-url> |
Unfollow a feed by name or url |
gator browse [limit] |
Browse posts from your followed feeds |
gator agg <duration> |
Continuously fetch posts every <duration> (e.g. 60s); press q or Ctrl-C to stop |
gator reset |
Delete all users and their data |
Languages
Go
100%