mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-25 20:33:08 +00:00
Add command-not-found handler for Arch Linux
- checks for `pkgfile`, which is an optional (but official) package used for searching for packages given a file
This commit is contained in:
parent
df6f1e8f62
commit
793784c087
1 changed files with 12 additions and 0 deletions
|
@ -234,6 +234,18 @@ function __fish_config_interactive -d "Initializations that should be performed
|
|||
function __fish_command_not_found_handler --on-event fish_command_not_found
|
||||
command-not-found -- $argv
|
||||
end
|
||||
# pkgfile is an optional, but official, package on Arch Linux
|
||||
# it ships with example handlers for bash and zsh, so we'll follow that format
|
||||
else if type -p -q pkgfile
|
||||
function __fish_command_not_found_handler --on-event fish_command_not_found
|
||||
set -l __packages (pkgfile --binaries --verbose -- $argv ^/dev/null)
|
||||
if test $status -eq 0
|
||||
printf "%s may be found in the following packages:\n" "$argv"
|
||||
printf " %s\n" $__packages
|
||||
else
|
||||
__fish_default_command_not_found_handler $argv
|
||||
end
|
||||
end
|
||||
# Use standard fish command not found handler otherwise
|
||||
else
|
||||
function __fish_command_not_found_handler --on-event fish_command_not_found
|
||||
|
|
Loading…
Reference in a new issue