A simple Python command-line tool to display random quotes from text files.
- Random Quote Display: Prints a random quote from the selected quote file.
- Multiple Quote Files: Supports using multiple quote files stored in a designated “quotes” directory.
- Configurable Default: Set a default quote file using the provided command-line options.
- Clone the repository:
git clone https://github.com/dkrashen/cookie.git- Ensure Python 3 is installed:
Run the script from the command line:
Display a Random Quote (Using the Default Quote File):
python3 cookie.pyList Available Quote Files:
python3 cookie.py –-listThis will display all quote files found in the “quotes” directory.
Set a Default Quote File:
python3 cookie.py -–set-default filenameSpecify a Quote File for a Single Run:
python3 cookie.py -–file filenameThis option overrides the default quote file for that run.
Add a Quote File:
python3 cookie.py -–add filenameor
python3 cookie.py -a filenameThe file should be formatted as below. If the file already exists, the user will be prompted to overwrite.
Add a Quote File (force overwrite):
python3 cookie.py -–add --force filenameor
python3 cookie.py -af filenameUse a line containing only the “%” character (ignoring surrounding whitespace) as a delimiter.
Example:
Quote 1: Life is what happens when you’re busy making other plans. % Quote 2: To be yourself in a world that is constantly trying to make you something else is the greatest accomplishment. % Quote 3: The only limit to our realization of tomorrow is our doubts of today.
Each section between “%” lines is treated as an individual quote.
Contributions are welcome! Please open issues or submit pull requests if you have suggestions or improvements.
This project was written by Danny Krashen with help by ChatGPT and Claude. It is licensed under the Creative Commons Attribution License (CC BY). See the LICENSE file for details.
