Gator is a versatile command-line interface (CLI) tool designed to help you manage and aggregate blog feeds efficiently. Whether you're a developer or a content enthusiast, Gator streamlines the process of handling RSS feeds, user management, and more.
Before you begin, ensure you have the following software installed on your system:
Gator is built using the Go programming language. You need to have Go installed to run and manage the CLI.
- Installation Instructions: You can download and install Go from the official website. Follow the installation guide suitable for your operating system.
Gator relies on PostgreSQL for data storage. Ensure you have PostgreSQL installed and running.
- Installation Instructions: Download PostgreSQL from the official website and follow the installation steps for your operating system.
To install the Gator CLI, follow these steps:
-
Build the Executable:
go build -o gator
This command builds the Gator executable and names it
gator
. Ensure that your module name initialized withgo mod init
matches your project structure. -
Install the CLI:
go install github.com/marcuschui2022/blog-aggregator@latest
This command will download the latest version of Gator and install the executable in your
$GOPATH/bin
directory. Ensure that this directory is included in your system'sPATH
to run Gator from any location.
Before running Gator, you need to set up the configuration file to connect to your PostgreSQL database.
-
Create Configuration File: Gator expects a configuration file (e.g.,
config.yaml
) in the project directory. Create this file with the following structure:db_url: "postgres://username:password@localhost:5432/gator_db?sslmode=disable" current_user: "your_username"
- db_url: Replace
username
,password
,localhost
,5432
, andgator_db
with your PostgreSQL credentials and database details. - current_user: Set this to your desired default username.
- Ensure Proper Permissions: Make sure the configuration file has the correct permissions to prevent unauthorized access to sensitive information.
Alternatively, you can manually create a configuration file in your home directory.
-
Create Configuration File: Manually create a config file in your home directory,
~/.gatorconfig.json
, with the following content:{ "db_url": "postgres://example" }
- db_url: Replace
"postgres://example"
with your actual PostgreSQL connection string.
- Set Environment Variable (Optional):
If you prefer to use the home directory configuration, ensure that Gator points to this file. You might need to set an environment variable or modify the application's configuration loading logic to prioritize
~/.gatorconfig.json
.
Once installed and configured, you can start using Gator to manage your blog feeds and users.
Navigate to the directory containing the config.yaml
file (if using project directory configuration) or ensure your home directory configuration is set up, then execute the CLI:
Here are some of the essential commands you can run with Gator:
-
Register a New User Create a new user account.
gator register <username>
Example:
gator register john_doe
-
Login as a User Switch to an existing user account.
gator login <username>
Example:
gator login john_doe
-
Add a New Feed Add a new RSS feed to your account.
gator addfeed <feed_name> <feed_url>
Example:
gator addfeed TechNews https://example.com/rss
-
List All Feeds Display all the feeds you have added.
gator feeds
-
Browse Posts Browse the latest posts from your subscribed feeds. You can specify the number of posts to display.
gator browse [limit]
Example:
gator browse 10
-
Reset the Database
Warning: This command will delete all user data.
gator reset
-
Aggregate Feeds Automatically Collect feeds at regular intervals.
gator agg <time_between_requests>
Example:
gator agg 1h
Contributions are welcome! Please fork the repository and submit a pull request with your enhancements.
This project is licensed under the MIT License.
-
Clone the Repository:
git clone https://github.com/marcuschui2022/blog-aggregator.git cd blog-aggregator
-
Install Dependencies:
go mod download
-
Run the CLI:
go run . <command> [arguments]
Replace
<command>
and[arguments]
with your desired commands as outlined above.
For more detailed information and advanced usage, please refer to the official documentation.