Added fish_preexec and fish_postexec events

Fixes #1549.
This commit is contained in:
Jan-Thorsten Peter 2014-07-16 09:33:25 -07:00 committed by Kevin Ballard
parent 43e451d4d8
commit 646d9ab431
2 changed files with 11 additions and 0 deletions

View file

@ -39,6 +39,14 @@ By using one of the event handler switches, a function can be made to run automa
- `fish_command_not_found`, which is emitted whenever a command lookup failed.
- `fish_preexec`, which is emitted right before executing an interactive command. The commandline is passed as the first parameter.
Note: This event will be emitted even if the command is invalid. The commandline parameter includes the entire commandline verbatim, and may potentially include newlines.
- `fish_postexec`, which is emitted right after executing an interactive command. The commandline is passed as the first parameter.
Note: This event will be emitted even if the command is invalid. The commandline parameter includes the entire commandline verbatim, and may potentially include newlines.
\subsection function-example Example

View file

@ -2966,7 +2966,10 @@ static int read_i(void)
update_buff_pos(&data->command_line, 0);
data->command_line.text.clear();
data->command_line_changed(&data->command_line);
wcstring_list_t argv(1, command);
event_fire_generic(L"fish_preexec", &argv);
reader_run_command(parser, command);
event_fire_generic(L"fish_postexec", &argv);
if (data->end_loop)
{
handle_end_loop();