mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-27 14:51:14 -03:00
Make fish install a command_not_found handler in non-interactive uses.
Previously, fish's command_not_found handler would be installed in __fish_config_interactive. Errors that occured early in startup (e.g. in config.fish) or in non-interactive mode would therefore not be reported. With this change, fish now exposes its default cnf handler as __fish_default_command_not_found_handler . config.fish then installs a cnfh that invokes the default. When fish goes interactive, the initial cnfh is overwritten with a fancier one, that may in turn fall back to invoking the default.
This commit is contained in:
@@ -10,6 +10,21 @@
|
||||
|
||||
set -g IFS \n\ \t
|
||||
|
||||
#
|
||||
# Create the default command_not_found handler
|
||||
#
|
||||
function __fish_default_command_not_found_handler
|
||||
echo "fish: Unknown command '$argv'" >&2
|
||||
end
|
||||
|
||||
#
|
||||
# Hook up the default as the principal command_not_found handler
|
||||
# This is likely to be overwritten in __fish_config_interactive
|
||||
#
|
||||
function __fish_command_not_found_handler --on-event fish_command_not_found
|
||||
__fish_default_command_not_found_handler $argv
|
||||
end
|
||||
|
||||
#
|
||||
# Set default search paths for completions and shellscript functions
|
||||
# unless they already exist
|
||||
|
||||
Reference in New Issue
Block a user