3 unstable releases

new 0.2.1 Feb 28, 2025
0.2.0 Feb 25, 2025
0.1.0 Feb 24, 2025

#349 in Unix APIs

Download history

117 downloads per month

GPL-3.0-only

40KB
824 lines

filkoll

[ lib.rs ] [ crates.io ] [ AUR ] [ AUR (git) ]

Filkoll is:

  • A tool to figure out what package owns a file, with fuzzy matching.
  • A building block for a fast command-not-found handler for your shell.
  • Swedish for "file check".

Currently this only supports Arch Linux.

This is inspired by pkgfile, but hyper-optimised for doing the "command-not-found" handler as fast as possible.

Installation

Install using the AUR package. At this point in time, this is the only supported way to install.

Then to enable the nightly update job:

sudo systemctl enable --now filkoll-update.timer

To search you can use filkoll binary <mycommand>:

 filkoll binary bash
core/bash 5.2.037-1                      /usr/bin/bash    (exact match)
core/bash 5.2.037-1                      /usr/bin/rbash
core/dash 0.5.12-1                       /usr/bin/dash
extra/avahi 1:0.8+r194+g3f79789-3        /usr/bin/bssh
extra/bass 1.2-14                        /usr/bin/bass
extra/reaver 1.6.6-1                     /usr/bin/wash

The results are sorted by how close the match is, with the closest results at the top. See filkoll --help, filkoll binary --help etc for more information on available flags.

To use filkoll as a command-not-found handler, you can add the following to your shell configuration:

# Select one of these depending on which shell you use:
source /usr/share/doc/filkoll/command-not-found.bash
source /usr/share/doc/filkoll/command-not-found.fish
source /usr/share/doc/filkoll/command-not-found.zsh

Note, by default the command-not-found handler will not display fuzzy matches if there is an exact match. This is especially helpful for short commands as there can be many matches.

Benchmarks

filkoll is much faster than pkgfile (and this is using an unreleased version of pkgfile that has some improvements).

 hyperfine --warmup 5 -N "filkoll/target/release/filkoll binary uv" "pkgfile/build/pkgfile -b uv"
Benchmark 1: filkoll/target/release/filkoll binary uv
  Time (mean ± σ):       5.2 ms ±   1.6 ms    [User: 3.3 ms, System: 1.5 ms]
  Range (min … max):     2.9 ms …  10.1 ms    865 runs
 
Benchmark 2: pkgfile/build/pkgfile -b uv
  Time (mean ± σ):     239.0 ms ±  25.6 ms    [User: 1310.1 ms, System: 54.7 ms]
  Range (min … max):   217.2 ms … 309.5 ms    12 runs
 
Summary
  filkoll/target/release/filkoll binary uv ran
   46.32 ± 15.48 times faster than pkgfile/build/pkgfile -b uv

filkoll is fast enough that it will feel instant to the user in other words. pkgfile is not.

MSRV (Minimum Supported Rust Version) policy

The MSRV may be bumped as needed. It is guaranteed that this program will at least build on the current stable Rust release. An MSRV change is not considered a breaking change and as such may change even in a patch version.

Dependencies

~17–29MB
~459K SLoC