This is a small command-line RSS reader written in Go.
You need both Go and Postgres installed to run this program.
Install the CLI with go install:
go install github.com/sahibjot01/blogaggregator@latestIf you are working from a fork or a different module path, replace the import path with the one for your repo.
The command examples below use gator as the binary name. If your installed binary has a different name, use that name instead.
Before the CLI can save anything, the Postgres database and schema need to exist.
If you do not already have a gator database, create one first:
createdb gatorThen apply the migrations from the sql/schema directory:
goose -dir sql/schema postgres "postgres://user:password@localhost:5432/gator?sslmode=disable" upThat creates the tables the CLI expects, including users, feeds, feed follows, and posts.
The program reads its config from ~/.gatorconfig.json.
Create that file with your Postgres connection string and the current user name:
{
"db_url": "postgres://user:password@localhost:5432/gator?sslmode=disable",
"current_user_name": ""
}db_url should point to your local Postgres database. If you are using a different user, password, host, or database name, update the value accordingly.
After installing, run the CLI from anywhere on your machine.
gator register <name>
gator login <name>The first command creates a user and switches to it. The second command switches to an existing user.
gator usersprints all users in the database.gator feedslists all registered feeds.gator addfeed <name> <url>creates a feed and follows it for the current user.gator follow <url>follows an existing feed.gator unfollow <url>stops following a feed.gator followingshows the feeds the current user follows.gator browse <limit>shows posts for the current user, up to the limit you pass in.gator agg <duration>keeps fetching feeds on a timer, for examplegator agg 1m.gator resetclears the users table and resets the current user in the config.
If you change the database name, user, or password, update both the Postgres connection string and the migration command to match.