aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_config_interactive.fish
diff options
context:
space:
mode:
authorGravatar Konrad Borowski <glitchmr@myopera.com>2013-07-19 09:56:47 +0200
committerGravatar Konrad Borowski <glitchmr@myopera.com>2013-07-19 09:56:47 +0200
commit58ad04b61cf567c7a8756869f19d6d5682122b12 (patch)
treee22baf60a0068de8a8de1cf1e65911e7457be7b3 /share/functions/__fish_config_interactive.fish
parent97bea94550819efcdffb1213b5d425d5f1af66d9 (diff)
Avoid standard command not found message when command-not-found is found
Squashed commit of the following: commit c208bc30b7747b3743212483b3dd7e3f90819f49 Merge: 97bea94 2633372 Author: Konrad Borowski <glitchmr@myopera.com> Date: Fri Jul 19 09:56:12 2013 +0200 Merge branch 'command-not-found' of git://github.com/GlitchMr/fish-shell into command-not-found commit 26333721b9048333d1e7932505c221a31fd0e624 Author: Konrad Borowski <glitchmr@myopera.com> Date: Fri Jul 19 09:55:13 2013 +0200 Fix command_not_found when not found commit db34460bb51a4b1c1c456c2e535ae8d913d1071e Author: Konrad Borowski <glitchmr@myopera.com> Date: Wed Jul 17 13:41:57 2013 +0200 Avoid showing standard command not found message when possible In bash, command-not-found handler causes the standard messages to not appear. Because of events model in fish, it isn't really an option, so I moved the standard command not found message to fish function. This way, the messages aren't repeated, and the standard command not found message appears only when handler couldn't be found.
Diffstat (limited to 'share/functions/__fish_config_interactive.fish')
-rw-r--r--share/functions/__fish_config_interactive.fish18
1 files changed, 10 insertions, 8 deletions
diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish
index 814fff19..d7961861 100644
--- a/share/functions/__fish_config_interactive.fish
+++ b/share/functions/__fish_config_interactive.fish
@@ -218,21 +218,23 @@ function __fish_config_interactive -d "Initializations that should be performed
function fish_command_not_found_setup --on-event fish_command_not_found
# 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
function fish_command_not_found_handler --on-event fish_command_not_found
/usr/lib/command-not-found $argv
end
- fish_command_not_found_handler $argv
+ # Ubuntu Feisty places this command in the regular path instead
+ else if type -p command-not-found > /dev/null 2> /dev/null
+ function fish_command_not_found_handler --on-event fish_command_not_found
+ command-not-found $argv
+ end
+ # Use standard fish command not found handler otherwise
else
- # Ubuntu Feisty places this command in the regular path instead
- if type -p command-not-found > /dev/null 2> /dev/null
- function fish_command_not_found_handler --on-event fish_command_not_found
- command-not-found $argv
- end
- fish_command_not_found_handler $argv
+ function fish_command_not_found_handler --on-event fish_command_not_found
+ echo fish: Unknown command "'$argv'" >&2
end
end
+ fish_command_not_found_handler $argv
end
end