rfortune 0.5.0

A Rust-based clone of the classic UNIX 'fortune' command
Documentation

๐Ÿฅ  rFortune

rFortune is a modern, cross-platform reimplementation of the classic Unix fortune program, written in Rust.

It displays a random quote or witty phrase from a plain text file, making it perfect for terminal startup messages, scripting, or just a bit of inspiration.

CI License MIT Platform GitHub release


๐Ÿš€ Features

  • โœ… Cross-platform: works on Linux, Windows, macOS Intel and Apple Silicon
  • โšก Fast and lightweight (native Rust binary)
  • ๐Ÿ“ Simple input format: one or more lines per fortune, separated by %
  • ๐ŸŒน UTF-8 support for multilingual content
  • ๐Ÿงฉ Easily extensible
  • ๐Ÿง  Built-in cache system to avoid showing the same fortune twice in a row
  • โœจ New CLI with subcommands for config, file initialization and cache management

๐Ÿ“ฆ Installation

Packaging status

๐Ÿง AUR (Arch Linux)

AUR

yay -S rfortune
# or
paru -S rfortune

๐Ÿบ Homebrew (macOS/Linux)

Homebrew Tap

brew tap umpire274/rfortune
brew install rfortune

๐Ÿฆ€ Crates.io (Rust)

Crates.io

cargo install rfortune

๐Ÿ“ฅ Download

Precompiled binaries are available in the Releases section.

Platform Architecture File
Windows x86_64 rfortune-<version>-x86_64-pc-windows-msvc.zip
Linux x86_64 rfortune-<version>-unknown-linux-gnu.tar.gz
macOS Intel Architecture x86_64 rfortune-<version>-x86_64-apple-darwin.tar.gz
macOS Apple Silicon aarch64 rfortune-<version>-aarch64-apple-darwin.tar.gz

๐Ÿ” GPG Signature

All release archives are cryptographically signed with GPG.

  • .sig files contain the ASCII-armored detached signature for the corresponding archive.
  • You can verify the archive with:
gpg --verify rfortune-<version>-<target>.tar.gz.sig rfortune-<version>-<target>.tar.gz

๐Ÿ”‘ Public Key

The releases are signed with the following GPG key:

To import the key from a keyserver:

gpg --recv-keys 423FABCE0A1921FB

Or from OpenPGP server:

gpg --keyserver keys.openpgp.org --recv-keys 423FABCE0A1921FB

Then verify the fingerprint:

gpg --fingerprint 423FABCE0A1921FB

๐Ÿš€ Usage

rfortune [OPTIONS]
rfortune <SUBCOMMAND>

Running rfortune without subcommands prints a random fortune from the default file (rfortune.dat).


๐Ÿงฉ Options & Subcommands

Command / Option Description
-f, --file <PATH> Use a custom fortune file instead of the default
config init Create the configuration file with default options
file init Create a sample default fortune file (rfortune.dat)
cache clear Remove all cached last-used fortunes
-V, --version Show version information
-h, --help Show help message

๐Ÿงช Examples

# Print a random fortune from the default file
rfortune

# Print a random fortune from a specific file
rfortune --file ~/fortunes/misc

# Initialize configuration file
rfortune config init

# Create a sample default fortune file
rfortune file init

# Clear all cached last-used fortunes
rfortune cache clear

๐Ÿ“ File Format

Each fortune must be on one or more lines separated by %, like so:

%
The best way to get a good idea is to get a lot of ideas.
%
Do or do not. There is no try.
%
To iterate is human, to recurse divine.
%

You may optionally add a title at the top of the file by starting the first line with #. The title will be printed before the random quote:

# Murphy's Laws
%
Anything that can go wrong will go wrong.
%
If there's a possibility of several things going wrong, the one that will cause the most damage will be the one to go wrong.
%

๐Ÿ”’ License

This project is licensed under the MIT License.

ยฉ 2025 Alessandro Maestri


๐Ÿ’ก Contributing

Pull requests are welcome! If youโ€™d like to add support for more languages, improve performance, or fix bugs, feel free to fork the repo and contribute.


๐Ÿ™Œ Acknowledgments

Inspired by the classic BSD fortune program. Built with โค๏ธ in Rust.