OSSQuotes
is a Node.js Command Line Interface (CLI) tool designed for fetching and displaying quotes from the OSS 117 quotes API. It offers functionality to retrieve random quotes, filter quotes by characters, or search for quotes containing specific keywords.
- Retrieve a specified number of random quotes.
- Filter quotes by specific characters using their slug.
- Search for quotes containing specified keywords.
- Node.js (Version 12.x or higher is recommended)
Clone this repository or download the source code.
git clone https://github.com/yourusername/ossquotes-cli.git
cd ossquotes-cli
chalk for terminal string styling. node-fetch for making HTTP requests. yargs for parsing command-line arguments.
Install the required dependencies.
npm install
Optionally, link the package globally to use the ossquotes command anywhere on your system.
npm link
Global Execution After global installation, you can use the ossquotes command followed by options:
ossquotes [options]
Within the project directory, execute the script using npm:
npm run fetch-quotes -- [options]
-n, --number <number> - Specify the number of quotes to fetch (default: 1).
-c, --character <characterSlug> - Fetch quotes from a specific character.
-k, --keyword <keyword> - Fetch quotes containing a specific keyword.
Examples Fetch with all options:
npm run fetch-quotes -- --number=30 --keyword=tu --character=bill
Fetch a single random quote:
ossquotes
Fetch five random quotes:
ossquotes -n 5
Fetch quotes from "Hubert":
ossquotes -c hubert
Fetch quotes containing "avec":
ossquotes -k avec
The project uses the following main packages:
chalk for terminal string styling. node-fetch for making HTTP requests. yargs for parsing command-line arguments.