From 2ef600810284f6fe65f85cd2df85a48298cf3527 Mon Sep 17 00:00:00 2001 From: capynq Date: Mon, 21 Apr 2025 00:59:46 +0300 Subject: [PATCH] feat(command-not-found): added pkgfile presence check and install guide --- .../command-not-found/command-not-found.plugin.zsh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/command-not-found/command-not-found.plugin.zsh b/plugins/command-not-found/command-not-found.plugin.zsh index c741e18a2..90a40adcb 100644 --- a/plugins/command-not-found/command-not-found.plugin.zsh +++ b/plugins/command-not-found/command-not-found.plugin.zsh @@ -1,8 +1,18 @@ ## Platforms with a built-in command-not-found handler init file +# Arch Linux: required 'pkgfile' +if [[ -f /etc/arch-release ]]; then + if command -v pkgfile >/dev/null 2>&1; then + if [[ -f /usr/share/doc/pkgfile/command-not-found.zsh ]]; then + source /usr/share/doc/pkgfile/command-not-found.zsh + return 0 + fi + else + printf "Warning: 'pkgfile' is not installed,\nYou can install it via: sudo pacman -S pkgfile\n" >&2 + fi +fi + for file ( - # Arch Linux. Must have pkgfile installed: https://wiki.archlinux.org/index.php/Pkgfile#Command_not_found - /usr/share/doc/pkgfile/command-not-found.zsh # Homebrew: https://github.com/Homebrew/homebrew-command-not-found /opt/homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh /usr/local/Homebrew/Library/Taps/homebrew/homebrew-command-not-found/handler.sh