mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-13 07:21:13 -03:00
Avoid standard command not found message when command-not-found is found
Squashed commit of the following: commit c208bc30b7747b3743212483b3dd7e3f90819f49 Merge:97bea942633372Author: 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 commit26333721b9Author: Konrad Borowski <glitchmr@myopera.com> Date: Fri Jul 19 09:55:13 2013 +0200 Fix command_not_found when not found commitdb34460bb5Author: 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.
This commit is contained in:
16
parser.cpp
16
parser.cpp
@@ -2027,6 +2027,7 @@ int parser_t::parse_job(process_t *p,
|
||||
for this, used by other shells like bash
|
||||
and zsh).
|
||||
*/
|
||||
|
||||
if (wcschr(cmd, L'='))
|
||||
{
|
||||
wchar_t *cpy = wcsdup(cmd);
|
||||
@@ -2076,9 +2077,15 @@ int parser_t::parse_job(process_t *p,
|
||||
}
|
||||
else
|
||||
{
|
||||
debug(0,
|
||||
_(L"Unknown command '%ls'"),
|
||||
cmd?cmd:L"UNKNOWN");
|
||||
/*
|
||||
Handle unrecognized commands with standard
|
||||
command not found handler that can make better
|
||||
error messages
|
||||
*/
|
||||
|
||||
wcstring_list_t event_args;
|
||||
event_args.push_back(args.at(0).completion);
|
||||
event_fire_generic(L"fish_command_not_found", &event_args);
|
||||
}
|
||||
|
||||
tmp = current_tokenizer_pos;
|
||||
@@ -2090,9 +2097,6 @@ int parser_t::parse_job(process_t *p,
|
||||
|
||||
job_set_flag(j, JOB_SKIP, 1);
|
||||
|
||||
wcstring_list_t event_args;
|
||||
event_args.push_back(args.at(0).completion);
|
||||
event_fire_generic(L"fish_command_not_found", &event_args);
|
||||
proc_set_last_status(err==ENOENT?STATUS_UNKNOWN_COMMAND:STATUS_NOT_EXECUTABLE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user