aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_config_interactive.fish
diff options
context:
space:
mode:
authorGravatar T. Jameson Little <t.jameson.little@gmail.com>2015-01-30 22:01:40 -0700
committerGravatar T. Jameson Little <t.jameson.little@gmail.com>2015-01-30 22:01:40 -0700
commit793784c08778e8b3fb9d8a2a5621bd968db1dfbe (patch)
treed2520581ec7c6dc7e22cffb82a4af1e8d268cab2 /share/functions/__fish_config_interactive.fish
parentdf6f1e8f62bd95597f4774ead4e60680464cf164 (diff)
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
Diffstat (limited to 'share/functions/__fish_config_interactive.fish')
-rw-r--r--share/functions/__fish_config_interactive.fish12
1 files changed, 12 insertions, 0 deletions
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index 4bd04b62..ea71a72a 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -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