Skip to content

vromero/gofortune

Repository files navigation

GoFortune Logo

GoFortune

Print a random, hopefully interesting, adage.

Release Software License


GoFortune is a Go implementation of the classic Unix fortune and strfile utilities. It aims for compatibility with the fortune-mod 1.0 storage format.

Installation

You can install GoFortune using go install:

go install github.com/vromero/gofortune@latest

Usage

Fortune

Print a random adage:

gofortune

Useful flags:

  • -s short fortunes only, -l long only, -n N threshold (default 160)
  • -m PATTERN print all fortunes matching a regular expression, -i case-insensitive
  • -o pick from offensive fortunes only, -a all maxims
  • -c show the cookie file a fortune came from
  • -f print the list of candidate files and their probabilities
  • -e weight every file equally regardless of size
  • -w pause after printing, scaling with the length of the fortune

Provide one or more paths (optionally preceded by N% to weight them) to override the default /usr/share/games/fortunes location:

gofortune 30% /path/to/my/fortunes 70% /path/to/other/fortunes

Strfile

Create a random access index file for storing strings:

gofortune strfile <source_file> [data_file]

Example:

# Create an index from fortunes.txt and save it as fortunes.txt.dat
gofortune strfile fortunes.txt

I18n (Internationalization)

GoFortune supports multiple languages. When the LANG environment variable is set, the tool will attempt to find fortunes in the corresponding directory (e.g., /usr/share/games/fortunes/es).

Contributing

This project adheres to the Contributor Covenant code of conduct. Please refer to our contributing guidelines for more information.

About

Print a random, hopefully interesting, adage.

Topics

Resources

License

Code of conduct

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors