Skip to content

Th3Whit3Wolf/pquote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pquote

Programmer Quotes Library & Binary

Continuous Integration Coverage Status Documentation License Rust

List of 323 Quotes from various programmer's

Why

I really liked Vim Startify's programmer quotes every time I used vim. I originally made this to get the same quotes for Dashboard Nvim but I ended up using it for MOTD on remote servers and some other random projects(I love programmer quotes) so I thought I might as well make it a library to make it easier to use.

Why is the binary in the examples directory

The binary is an example because it means all of it's dependencies can be kept seperate from the dependencies of the library, (as far as I can tell there is no way to do this with the lib & main inside src/ or with workspaces) so that if you use this library you're not pulling in 19 other crates you don't need.

How to use

Library

# Cargo.toml

[dependencies]
pquote = { git = "https://github.com/Th3Whit3Wolf/pquote" }
// main.rs or lib.rs

use pquote::QUOTES;

Example

Want to generate a random quote?

use rand::Rng;
use pquote::QUOTES;

fn main() {
    // Get Random Quote
    let x = rand::thread_rng().gen_range(0, QUOTES.len());
    // Print quote and author
    println!("Quote: {}", q.quote);
    println!("\t- {}", q.author);
}

Click here for a much more in-depth example.

Binary

pquote 0.2.0
Programmer Quote Generator

USAGE:
    pquote <FLAGS>

FLAGS:
    -h,--help                Prints help information
    -V,--version             Prints version information
    -v,--verbose             Prints quote verbosely
    -A,--all                 Print all quotes
    -i,--id <id>             Choose quote by id
    -a,--author <author>     Choose quote by author
    -o,--origin <origin>     Choose quote by origin (azquotes,goodreads,journaldev,vimstartify,stormconsultancy)

Prequisites

  • Rust - if not installed run curl https://sh.rustup.rs -sSf | sh

Install

git clone https://github.com/Th3Whit3Wolf/pquote.git
cd pquote
cargo install --example pq

Example Output

    The most fundamental problem in software development is complexity.
    There is only one basic way of dealing with complexity: divide and conquer

    - Bjarne Stroustrup

Credits & Contribution

Vim Startify with it's awesome quotes inspired to make this and I borrowed it's content.

This Programming Quotes API also gave a good amount of quotes.