Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Official Packages

The Whim project maintains Trifle packages on Codeberg. Each package has its own repository.

These packages use names under Trifle\. Their Git tags define their versions. Install them through Whim’s Git package manager.

PackageDescriptionInstall
ansiANSI colours, styles, cursor movement, and screen controls.whim add git+ssh://[email protected]/trifle/ansi
argsTyped command-line parsing and generated usage.whim add git+ssh://[email protected]/trifle/args
cacheStampede-safe local LRU and database caches.whim add git+ssh://[email protected]/trifle/cache
configTyped configuration from values, files, and the environment.whim add git+ssh://[email protected]/trifle/config
consoleTerminal output, tables, progress, and prompts.whim add git+ssh://[email protected]/trifle/console
cqrsCommand and query buses with events, logs, and traces.whim add git+ssh://[email protected]/trifle/cqrs
diffMyers diffs for values and text, with unified output.whim add git+ssh://[email protected]/trifle/diff
dotenv.env parsing and environment layering.whim add git+ssh://[email protected]/trifle/dotenv
eventTyped events with hierarchy-aware listeners.whim add git+ssh://[email protected]/trifle/event
expectFluent expectations for tests.whim add git+ssh://[email protected]/trifle/expect
fakeDeterministic fake data generated from a seed.whim add git+ssh://[email protected]/trifle/fake
feedAtom and RSS feed generation.whim add git+ssh://[email protected]/trifle/feed
humanizeHuman-readable durations, sizes, counts, and numbers.whim add git+ssh://[email protected]/trifle/humanize
lockLeased mutual exclusion over pluggable stores.whim add git+ssh://[email protected]/trifle/lock
logStructured logging with composable loggers.whim add git+ssh://[email protected]/trifle/log
markdownCommonMark and GitHub-flavoured Markdown parsing.whim add git+ssh://[email protected]/trifle/markdown
markdown-ansiMarkdown rendering for styled terminal text.whim add git+ssh://[email protected]/trifle/markdown-ansi
markdown-htmlMarkdown rendering for HTML.whim add git+ssh://[email protected]/trifle/markdown-html
moneyInteger money, ISO 4217 currencies, and lossless allocation.whim add git+ssh://[email protected]/trifle/money
otpHOTP, TOTP, and authenticator provisioning.whim add git+ssh://[email protected]/trifle/otp
qrQR code generation with matrix and SVG output.whim add git+ssh://[email protected]/trifle/qr
queueMessage queues with retries, workers, and pluggable stores.whim add git+ssh://[email protected]/trifle/queue
sealSealed payloads and signed JWTs with key rotation.whim add git+ssh://[email protected]/trifle/seal
semverSemantic versions and Cargo-style requirements.whim add git+ssh://[email protected]/trifle/semver
templateLogic-less Mustache templates rendered from JSON values.whim add git+ssh://[email protected]/trifle/template
themePaints and themes for terminal text.whim add git+ssh://[email protected]/trifle/theme
traceTimed spans recorded through structured logs.whim add git+ssh://[email protected]/trifle/trace

Codeberg hosts all Trifle package repositories.

After you add Trifle\Diff and load vendor/autoload.whim, you can compare two sequences:

use Trifle\Diff;
use Trifle\Diff\Operation;

$edits = Diff\diff::<string>(vec['a', 'b', 'c'], vec['a', 'c', 'd']);

foreach ($edits as $edit) {
  $marker = match ($edit->operation) {
    Operation::Keep => ' ',
    Operation::Delete => '-',
    Operation::Insert => '+',
  };

  write_line!($marker . ' ' . $edit->value);
}

See Git Dependencies for manifests, locks, updates, and autoloading.