aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_config_interactive.fish
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2014-02-02 21:39:17 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2014-02-02 21:42:24 +0800
commit27b6fe682db3018f3ccbaf6f6f25b4ef81869316 (patch)
tree3d7bf84a044d9e6265cdd47d55f727cf47f36b7a /share/functions/__fish_config_interactive.fish
parenta1b43b7a09b223e9add2b3c6aa6e8e46e8bff0e5 (diff)
Squashed commit of the following:
commit d81ae2665fb7ff5123d8472e1d40d7d57fb4b291 Author: Max Gonzih <gonzih@gmail.com> Date: Sun Feb 2 16:22:18 2014 +0300 Check for command-not-found command on suse commit 004b794c82d79bc9463cdb52784b9b5ea49f1c76 Author: Max Gonzih <gonzih@gmail.com> Date: Sun Feb 2 14:04:41 2014 +0300 Fix cnf handler for Suse and Fedora fixes #1208
Diffstat (limited to 'share/functions/__fish_config_interactive.fish')
-rw-r--r--share/functions/__fish_config_interactive.fish16
1 files changed, 14 insertions, 2 deletions
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index b9afedd4..9ff7edc2 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -237,8 +237,20 @@ function __fish_config_interactive -d "Initializations that should be performed
# Remove fish_command_not_found_setup so we only execute this once
functions --erase __fish_command_not_found_setup
- # First check in /usr/lib, this is where modern Ubuntus place this command
- if test -f /usr/lib/command-not-found
+ # First check if we are on OpenSUSE since SUSE's handler has no options
+ # and expects first argument to be a command and second database
+ # also check if there is command-not-found command.
+ if begin; test -f /etc/SuSE-release; and type -p command-not-found > /dev/null 2> /dev/null; end
+ function __fish_command_not_found_handler --on-event fish_command_not_found
+ /usr/bin/command-not-found $argv
+ end
+ # Check for Fedora's handler
+ else if test -f /usr/libexec/pk-command-not-found
+ function __fish_command_not_found_handler --on-event fish_command_not_found
+ /usr/libexec/pk-command-not-found -- $argv
+ end
+ # Check in /usr/lib, this is where modern Ubuntus place this command
+ else if test -f /usr/lib/command-not-found
function __fish_command_not_found_handler --on-event fish_command_not_found
/usr/lib/command-not-found -- $argv
end