Add support for `pacman -F`/`pkgfile`
A nice feature that's missing is the support for pacman -F/pkgfile https://wiki.archlinux.org/index.php/Pacman#Search_for_a_package_that_contains_a_specific_file https://wiki.archlinux.org/index.php/Pkgfile.
This kind of feature can be used to suggest package installation when executing a missing binary, like so (for zsh):
command_not_found_handler() {
pkgs=($(pkgfile -b -- "$1"))
if [[ -n "$pkgs" ]] ; then
echo "Command not found but package found!" >&2
echo "Installing ${pkgs[1]}\n" >&2
sudo pacman -S ${pkgs[1]} >&2
echo "\nExecuting $@" >&2
"$@"
return $?
else
echo "Command or package not found: $1" >&2
return 127
fi
}
$ wget
zsh: correct wget to _wget [nyae]? n
Command not found but package found!
Installing extra/wget
resolving dependencies...
looking for conflicting packages...
Packages (1) wget-1.20.3-2
Total Installed Size: 2.88 MiB
:: Proceed with installation? [Y/n]
[...]
Executing wget
wget: missing URL
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
@jody-frankowski That feature is great for pacman, but I am not sure it's supported on other distribution. What distro/OS you're using with pacapt now? Thanks
A nice feature that's missing is the support for pacman -F/pkgfile
+++++++++ :)
That feature is great for pacman, but I am not sure it's supported on other distribution.
dpkg -S file
Example:
dpkg -S zramctl
util-linux: /sbin/zramctl
util-linux: /usr/share/bash-completion/completions/zramctl
util-linux: /usr/share/man/man8/zramctl.8.gz
Here is a (non-exhaustive) list of other distros implementations: https://ostechnix.com/find-package-provides-specific-file-linux/ (Forgot to answer. Sorry!)