Official Packages
The Whim project maintains packages in the Trifle group on Codeberg. They live outside the main Whim repository and do not ship with the standard library.
These packages use names under Trifle\. Their Git tags define their
versions. Install them through Whim’s Git package manager.
For example, this command adds the command-line argument parser:
whim add git+ssh://[email protected]/trifle/args
The group includes:
Trifle\Clockfor clocks and sleep that tests can controlTrifle\Difffor value and text diffsTrifle\SemVerfor semantic versions and version requirementsTrifle\Argsfor command-line arguments
The Trifle group lists all official packages.
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.