Cowsay Generator
Table of contents
CowsayGenerator ๐ฎ
CowsayGenerator is a fun and lightweight Go program that generates motivational or humorous quotes using OpenAI's GPT API and displays them with the classic cowsay
terminal program. It's perfect for brightening your day whenever you open a terminal!
Features
- ๐ค AI-Powered Quotes: Generates unique, funny, or motivational quotes using OpenAI's GPT.
- ๐ Cowsay Integration: Pairs the generated quotes with the delightful ASCII cows from
cowsay
. - ๐ Terminal Startup: Easily set it up to run automatically when you open a terminal.
Prerequisites
1. Install Required Tools
- Go: Install Go (version 1.18 or later).
- Cowsay: Install the
cowsay
program.- On Arch Linux:
sudo pacman -S cowsay
- On Debian/Ubuntu:
sudo apt install cowsay
- On macOS:
brew install cowsay
- On Arch Linux:
2. OpenAI API Key
- Sign up at OpenAI and get an API key.
- Add the API key as an environment variable (add to shell config file to persist):
export OPENAI_API_KEY=your_api_key_here
Installation
-
Clone the Repository
git clone https://github.com/ksande91/cowsay-generator.git cd cowsay-generator
-
Build the Program
go build -o cowsaygenerator
-
Run the Program
./cowsaygenerator
Usage
1. Run It Manually
From the folder where cowsaygenerator
resides:
./cowsaygenerator
2. Run It Automatically on Terminal Startup
To make the program run every time you open a terminal:
For Bash:
Edit your ~/.bashrc
file:
nano ~/.bashrc
Add this line:
/path/to/cowsaygenerator
Save and reload:
source ~/.bashrc
For Zsh:
Edit your ~/.zshrc
file:
nano ~/.zshrc
Add this line:
/path/to/cowsaygenerator
Save and reload:
source ~/.zshrc
For Fish:
Edit your ~/.config/fish/config.fish
file:
nano ~/.config/fish/config.fish
Add this line:
/path/to/cowsaygenerator
Save and reload:
source ~/.config/fish/config.fish
Example Output
Hereโs what youโll see when you run the program:
__________________________
< "Donโt moooove too fast, enjoy the grass!" >
--------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
License
This project is licensed under the MIT License. See the LICENSE file for details.
Start a deeper conversation
Go beyond the comments โ open a conversation to ask a question, share ideas, or explore this publication further with the community.