This project was for me to learn how to use PostgreSQL along with Goose and SQLC. It was apart of Boot.dev's Golang course.
- Golang
- PostgreSQL 18+
Install project:
go install github.com/OriElbaz/gatorcli@latest
Alternatively, clone the repo and run go build -o gator.
Set up config file, just change "your-username":
{
"db_url": "postgres://YOUR-USERNAME:@localhost:5432/gator?sslmode=disable",
"current_user_name": ""
}
Because I really dont want to spend the time, I'll hand it off to Gemini to explain how to use the commands:
This README section is designed to be clear and informative, categorizing the commands based on whether they require an active login session (as indicated by your MiddlewareLoggedIn wrapper).
Gator CLI allows you to manage users, follow RSS feeds, and aggregate posts. Usage follows the pattern:
gator <command> [arguments]
These commands handle user creation and session switching.
register <name>Creates a new user in the database and logs in as that user.login <name>Switches the current user session to the specified user.usersLists all registered users. The currently logged-in user is marked with an asterisk(*).resetWarning: Clears all user data from the database. Use with caution.
These commands require the user to be logged in.
addfeed <name> <url>Adds a new RSS feed to the system and automatically follows it for the current user.feedsDisplays a list of all feeds in the system along with the names of the users who added them.follow <url>Creates a follow relationship between the current user and an existing feed URL.followingLists all the feeds the current user is currently following.unfollow <url>Removes the follow relationship for the specified feed URL.
These commands handle the background processing and viewing of posts.
agg <time_duration>Starts the aggregator. It will fetch the next pending feed every interval (e.g.,1m,1h, or30s). *Example:gator agg 1mbrowse [limit](Requires Login) Displays posts from the feeds the current user follows. You can optionally provide a limit (e.g.,gator browse 5).