Python version of old BSD Unix fortune program
Project description
# Introduction
fortune is a stripped-down implementation of the classic BSD Unix fortune command. It combines the capabilities of the strfile command (which produces the fortune index file) and the fortune command (which displays a random fortune). It reads the traditional fortune program’s text file format.
# Usage
Usage:
fortune [OPTIONS] /path/to/fortunes
OPTIONS
- -h, --help
Show usage and exit.
- -u, --update
Update the index file.
- -q, --quiet
When updating the index file, do so quietly.
- -V, --version
Show version and exit.
If you omit the path, fortune looks at the FORTUNE_FILE environment variable. If that environment variable isn’t set, fortune aborts.
# Fortune Cookie File Format
A fortune cookie file is a text file full of quotes. The format is simple: The file consists of paragraphs separated by lines containing a single ‘%’ character. For example:
A little caution outflanks a large cavalry. -- Bismarck % A little retrospection shows that although many fine, useful software systems have been designed by committees and built as part of multipart projects, those software systems that have excited passionate fans are those that are the products of one or a few designing minds, great designers. Consider Unix, APL, Pascal, Modula, the Smalltalk interface, even Fortran; and contrast them with Cobol, PL/I, Algol, MVS/370, and MS-DOS. -- Fred Brooks, Jr. % A man is not old until regrets take the place of dreams. -- John Barrymore
# Generating a Random Fortune
Just run:
fortune /path/to/fortunes
If your FORTUNE_FILE environment variable is set, you can run it as
fortune
# Differences
This version of fortune does not provide some of the more advanced capabilities of the original BSD program. For instance, it lacks:
the ability to mark offensive and inoffensive fortunes
the ability to separate long and short quotes
the ability to print all fortunes matching a regular expression
It does, however, provide the most important function: The ability to display a random quote from a set of quotes.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for fortune-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b49e1e31c27c195b8f3b2eea988587267bcf41ab4f4a7fb8654dd28e39634f2a |
|
MD5 | f299921e0c218a84d09095ef1b74c673 |
|
BLAKE2b-256 | 4dfe2356a411f85aa6b435419a693ec9388319146b7f363202b7aa5f1552eea2 |