An open API service indexing awesome lists of open source software.

https://github.com/shresht7/quotes-cli

A super simple CLI application to display inspirational quotes in the terminal.
https://github.com/shresht7/quotes-cli

cli command-line quotes

Last synced: 9 months ago
JSON representation

A super simple CLI application to display inspirational quotes in the terminal.

Awesome Lists containing this project

README

          

# `quotes`

A super simple CLI application to display inspirational quotes in the terminal.

## 📘 Usage

```sh
quotes --filepath ./quotes.csv --border "-" --border-color red
```

```
-------------------------------------------
Wise is the man who knows he knows nothing.
-- Socrates
-------------------------------------------
```

### 📖 Help

```
Usage: quotes [SUBCOMMAND] [OPTIONS]

Subcommands:
random Show a random quote
get Get a specific quote by ID
list List all quotes
create Add a new quote
--text The quote text (optional)
--author The author name (optional)
edit Opens the data-source file in the default editor
delete Delete a specific quote by ID
search Search for quotes by keyword
--text Search only in quote text
--author Search only in author name
help Show the help message
version Show the version number

Options:
-f, --filepath Path to the CSV file containing quotes (default: quotes.csv)
-s, --style The ansi styles/colors for the quote text
--author-style The ansi styles/colors for the author
-m, --margin The number of lines to leave as margin (default: 1)
-b, --border Border character (default: '=')
--border-color Color for the border (default: 'default')
--quotes Surround the quote with quotation marks
--no-borders Disables borders
--no-color / --plain Plain output
--format The format to use for the output (`csv`, `json`, `default`)

-h, --help Show the help message
-v, --version Show the version number

Examples:
quotes
quotes random
quotes --margin 2 --color cyan
```

---

## ⚙️ Configuration

The application can be configured using a `config.json` file located at `~/.config/quotes-cli/config.json` on all operating systems.

This file allows you to set default values for the various styling and output options. Command-line arguments will always override the settings in the config file.

Example (`config.json`):

```json
{
"filepath": "~/Documents/my-quotes.csv",
"style": "italic,yellow",
"author_style": "green",
"border": "*",
"border_color": "blue",
"margin": 1,
"no_borders": false,
"surround_with_quotes": true,
"output_format": "default"
}
```

---

## 📂 Source File Format

The application supports two file formats for quotes: CSV and JSON.

### CSV Format (`.csv`)

The CSV file should have two columns: `quote` and `author`. The first row is expected to be a header and will be skipped.

Example (`quotes.csv`):

```csv
quote,author
"The only true wisdom is in knowing you know nothing.","Socrates"
"Be yourself; everyone else is already taken.","Oscar Wilde"
```

### JSON Format (`.json`)

The JSON file should be an array of objects, where each object has a `quote` and an `author` field.

Example (`quotes.json`):

```json
[
{
"quote": "The only true wisdom is in knowing you know nothing.",
"author": "Socrates"
},
{
"quote": "Be yourself; everyone else is already taken.",
"author": "Oscar Wilde"
}
]
```

---

## 📄 License

[MIT License](./LICENSE)