Permalink
Browse files

Added fish_preexec and fish_postexec events

Fixes #1549.
  • Loading branch information...
1 parent 43e451d commit 646d9ab431f102588dfbc90e1c54ff879d164a8a Jan-Thorsten Peter committed with kballard Jul 16, 2014
Showing with 11 additions and 0 deletions.
  1. +8 −0 doc_src/function.txt
  2. +3 −0 reader.cpp
@@ -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
@@ -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();

0 comments on commit 646d9ab

Please sign in to comment.