A fast command not found handler for pacman
. It suggests which package to
install when you try to run a command from a package that isn't installed
$ tree
tree may be found in the following packages:
extra/tree /usr/bin/tree
The output is more or less the same as pkgfile
's hook
but is substantially faster. pkgfile
can take several seconds to complete,
which is easily confused for a successful command invocation
Hook | Cold cache | Warm cache |
---|---|---|
findpkg | 40ms | 1.4ms |
pkgfile | 1874ms | 440ms |
yay -S findpkg
Create/update the database
sudo pkgfile --update
Enable automatic database updates (Optional)
systemctl enable pkgfile.timer
Add the following to ~/.bashrc
command_not_found_handle() {
findpkg "$1"
}
Run:
function fish_command_not_found
findpkg $argv[1]
end
funcsave fish_command_not_found
Add the following to ~/.zshrc
command_not_found_handler() {
findpkg "$1"
}